Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

ashok25006323
New Contributor III

Last two months in dimension

I want last two months in dimension in povit table

please guide me

this is my data

5 Replies

Re: Last two months in dimension

Set analysis is the solution

Sum({<Factoryship_Moonth = {">=$(=Max(Factoryship_Moonth-1)) <=$(=Max(Factoryship_Moonth))"}>} Measure)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
ashok25006323
New Contributor III

Re: Last two months in dimension

I want the calculated condition in dimension not in expression

Re: Last two months in dimension

Perhaps this?

If(Factoryship_Moonth >= AddMonths(Max(TOTAL Factoryship_Moonth), -1) and Factoryship_Moonth <= Max(TOTAL Factoryship_Moonth), Factoryship_Moonth)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
leledifrapwc
New Contributor II

Re: Last two months in dimension

can't you create a the dimension in script? you can set a variable "max month" and then create the dimension by comparing the month field with "max month" and "max month -1". if true it assigns the month field value, null() otherwise

Re: Last two months in dimension

I think this should be enough

If(Factoryship_Moonth >= AddMonths(Max(TOTAL Factoryship_Moonth), -1), Factoryship_Moonth)

But I wonder why the OP doesn't want to use set analysis?