Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Previous Month Data

Hello Friends

i have a data where Month filed is there which has data like jan, feb, mar,.....dec

and Actuals

i want when filter select feb 2013 then i want

feb 2013 data and jan 2013 data

MON
Year
Actual
Jan20135
Feb20137
Mar20139

so in above if filter select 2013 year and then select feb

then i want

current month    previous month

7                              5

13 Replies
eduardo_dimperio
Specialist II
Specialist II

Ahhhh, ok, Thank You

juraj_misina
Luminary Alumni
Luminary Alumni

Hi,

from your script I can see that MON was a string value not a date field. Max() function does not work with strings. In general I recommend to use a "MonthID" concept where you create s sequence for every month period and work with that in your set analysis.

To create a MontID add this to your script:

Num#(YR)*12+Num(Month(Date#(MON, 'MMM'))     as MonthID

Then is expressions you can use

//current month

Sum({<Year, Month, MontID={$(=Max(MontID))}>} Actual) //turn off selections on all date fields and only select by MonthID

//previous month

Sum({<Year, Month, MontID={$(=Max(MontID)-1)}>} Actual)

Hope this helps.

Juraj

Anonymous
Not applicable
Author

Thanks a lot buddy

I have one more problem i have one more columns quarter as string what will i have to do

thanks again

juraj_misina
Luminary Alumni
Luminary Alumni

Hi, I'd calculate quarter from Month field, so you do not need to convert any strings. But I'll try to omit using it, quarters can get tricky