[Mondrian] Truncate decimal places in a measure aggregation

Eduardo Andrade eduardofandrade at gmail.com
Tue Aug 11 18:11:38 EDT 2009


Thanks a lot Julian on this one, it did the trick ! :)

I will also try to contribute, implementing the Floor function.

Regards,
Eduardo

On Fri, Aug 7, 2009 at 6:56 PM, Julian Hyde <jhyde at pentaho.com> wrote:

>  I don't think you can achieve this using formatting alone. I think you
> need to calculate a new measure.
>
> Analysis Services has a Floor function (inherited from Excel) but it is not
> implemented in Mondrian. So we can achieve the behavior using Round.
> (Formula is a bit more complicated if [Dias] can be negative. Exercise for
> the reader.)
>
> <CalculatedMember name="Floor Dias" dimension="Measures">
>     <Formula>Round([Measures].[Dias] - 0.5)</Formula>
> </CalcMeasure>
>
> Someone could contribute the Floor function. Code changes would be required
> to Excel.java and ExcelTest.java.
>
> Julian
>
>
>
>  ------------------------------
> *From:* mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org]
> *On Behalf Of *Eduardo Andrade
> *Sent:* Friday, August 07, 2009 9:15 AM
> *To:* Mondrian Mailing List
> *Subject:* [Mondrian] Truncate decimal places in a measure aggregation
>
> Hello guys,
> I'm here knocking with my head and I can't get the result that I want. I've
> searched on the xml_Schema page, the mondrian-2.2.2-technical-guide.pdf, and
> on the forums, but failed to find an anser to my question.
>
> Is it possible to format a measure truncating decimal places to its
> aggregated value in the mondrian xml definition ?
>
> Example :
> I've got the measure :
>     <Measure column="IPAPERIODOCALC" name="Dias" aggregator="sum"
> formatString="###,##0"/>
>
> And the sum is 134.87.
> What I would like to show is 134 only, but it shows 135.
>
> Does anyone knows if it is possible to do this ?
>
> Thank you.
>
> Regards,
> --
> Eduardo Andrade
> eduardofandrade at gmail.com
>
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
>


-- 
Eduardo Andrade
eduardofandrade at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20090811/fdaa50fa/attachment.html 


More information about the Mondrian mailing list