Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

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).

In advance, thanks 

Tags (2)
1 Solution

Accepted Solutions
MVP
MVP

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.

3 Replies

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.


talk is cheap, supply exceeds demand
MVP
MVP

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.

Not applicable

Re: YTD based on selections

Thanks! Worked perfectly!

Community Browser