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

Current & Previous Month based on Flag

Hi I check the posts on the Current Month but my problem is different.

The Current Month needs to be set using the CurrentMonthFlag which is set in the database.

Values which are required for reporting are:

CurrentMonth, Previous Month and Next Month.

I could get a CurrentMonth using the flag.

The problem is how do I get the previous Month. Can i create a nested query like a Nested SQL in QlikView ?

We have MonthID which is in a numeric format which can be used to do +1 or -1 for next or previous month.

Also how would we identify next month for the selected month.

Please Suggest.

7 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi,

You can achieve the above using set analysis. Create a num month

eg : load num(Month) as Monthnum from table.

output would be 01,02,03

Now in Expression. use

Sum({<Monthnum={$(=num(Month(today())))}>} Amount)

I hope this helps





Not applicable
Author

Will try this solution but the only problem here is the calender is not the normal calender so I cant use Today() the value has to be from the database based on the flag

deepakk
Partner - Specialist III
Partner - Specialist III

hi,

If it is from data based then you can use max(Month). If you can add a sample file then it would be easy to provide a solution

Not applicable
Author

Hi Deepak,

How would we get the Prev of Current Month.

And if a selection is done pervious of that.

Sample Data Below:

MonthIDMonthCurrent Month Flag
111Jan FY2011N
112Feb FY2011N
113Mar FY2011Y
114Apr FY2011N

Regards,

Chinmay

deepakk
Partner - Specialist III
Partner - Specialist III

hi,

PFA

Not applicable
Author

Hi Deepak,

Really appreciate your quick response, I am kind of new with the Set Analysis and finding it difficult to understand how i would use this in charts.

I was trying to save the CurrentMonth, Previous Month into a variable which I would be able to Use in the charts.

Regards,

Chinmay

deepakk
Partner - Specialist III
Partner - Specialist III

Any way which you feel comfortable you can work around.

But set analysis reduces the pressure on the chart as compare to if statement.

You will lots of forum on Set analysis, read it will be very useful