# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Talk to Experts Tuesday, Live Q&A, September 22: Moving from QlikView to Qlik Sense. REGISTER
cancel
Showing results for
Search instead for
Did you mean:
Highlighted
Creator

## last 13 months up to user selection

Hi All

what would be set analysis statement for selecting last 13 month from the select Year and month. Please see attached image what I want to do.

Thanks

Rashid

1 Solution

Accepted Solutions
Highlighted
MVP

Something like:

Count( {<YEAR, MONTH, Period={">=\$(=Date(MonthStart(Max(Period),-13)))  <=\$(=Date(Max(Period)))"}>} Measure)

Edit: removed redundant addmonths()

5 Replies
Highlighted
Contributor III

try this expression dis will work  acoording to ur feilds .

=Sum({<OrderDate={">=\$(=(MonthStart(Max(OrderDate),-12)))<=\$(=MonthEnd(Max(OrderDate),-12)"},Year=,Month=>} [Opportunity Amount])

Highlighted
MVP

Something like:

Count( {<YEAR, MONTH, Period={">=\$(=Date(MonthStart(Max(Period),-13)))  <=\$(=Date(Max(Period)))"}>} Measure)

Edit: removed redundant addmonths()

Highlighted
Master III

Hi tresesco‌,

Why we can't use Addmonths here??

like this MonthStart(AddMonths(max([Date]),-13))

Highlighted
MVP

You can. But when you get the same output with a less function, why overkill?

MonthStart(AddMonths(max([Date]),-13))

and

MonthStart(max([Date]),-13)

return the same output.

Highlighted
Creator

Hi Tresesco

Thank you for your help. Can you please just break down statement in portion and explain what portion is doing what? So me and others new comers can learn from it.

Count(  is doing count of MEASURE

>{<YEAR, MONTH,  ????

Period={">=\$(=Date(MonthStart(Max(Period),-13))) ????? -13 is period 05-2016, so its period is greater then 05-2016. what is \$(=Date(MonthStart(Max doing here?

<=\$(=Date(Max(Period)))"}>} ???? period selection is 05-2017, so it is less then equal to 05-2017 or what ever is selected

Measure)  is measure