3 Replies Latest reply: Oct 21, 2013 6:58 AM by Jon Einebærolm

# YTD based on selections

Dear all,

I am currently working on a solution that I need your help to solve.

We want to be able to select on year (År), month(Måned), quarter(kvaral). When doing these selections we want to present numbers for the period chosen YTD. In other words, if I do a selection on 2013 and march I want to see, jan feb and march for 2013. I found the below z-analysis.

sum({<MånedÅr={'>=\$(=date(yearstart(max(MånedÅr)),'MM-YYYY')) <=\$(=date(max(MånedÅr),'MM-YYYY'))'}>}FaktBeløp)

This expression enables me to do a selection in the below list box(månedår).

I also want to be able to perform selections in all calendar fundtions (all).

• ###### Re: YTD based on selections

This ought to do it, assuming I got the field names right:

sum({<År=, Halvår=, Kvaral=, MånedÅr={'>=\$(=date(yearstart(max(MånedÅr)),'MM-YYYY')) <=\$(=date(max(MånedÅr),'MM-YYYY'))'}>}FaktBeløp)

Selections in the fields will still influence the max function to get the correct maximum MånedÅr of the possible values. But those selections won't influence the sum. Only MånedÅr will do that.

• ###### Re: YTD based on selections

Hi,

Try like this, if you have date dimension in your datamodel

=Sum({<YearDimension=, MonthDimension=, DateDimension={'>=\$(=YearStart(Max(DateDimension)))<=\$(=Max(DateDimension))'}>} MeasureName)

Regards,

Jagan.

• ###### Re: YTD based on selections

Thanks! Worked perfectly!