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

Current / Previous Month and Quarter

Hi There 

I am looking for Set analysis or any other way to find current month / previous month and current quarter / previous quarter calculation. 

i.e When user selects any date from list box , it should show current month/previous month and current quarter/ previous quarter values.

I am date in below format.  cob_date - > 2019-06-28

measure name - "impact"

thanks for your help. 

 

11 Replies
ashishpalkar
Creator III
Creator III
Author

Thanks Steve , can you please provide the set expression. 

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Looking at the app that I posted a link to should help you.

Your variable should be:

vPrevious

=Date(Addmonths(Max([cob_date]),-1 ),'YYYY-MM-DD')

Your set analysis would then be:

{<cob_date={'$(vPrevious)'}>}

That is assuming that the date format for cob_date is in the format you specify.

If cob_date has individual days in in then that code will give you the same day in the previous month (i.e. if it is the 16th Sep it will give you 16th Aug only).

If you want full month you will need to create this in the load script;

LOAD
   cob_date,
   date(MonthStart(cob_date), 'MMM-YY') as cob_month,
   etc.

Your variable would then change to have the new format:

=Date(Addmonths(Max([cob_month]),-1 ),'MMM-YY')

And your set would reference the month field: 

{<cob_month={'$(vPrevious)'}>}

Hope that helps.

Steve