# [Mondrian] Truncate decimal places in a measure aggregation

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
>
> <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,
> --
>
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
>

--