Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

pankaj999
New Contributor III

Dynamic Last Month of Current Quarter

Hi,

I need to calculate sales for the current and last month of the current quarter. Now if we are on the first month then it should not calculate anything for the last months as its the first month of the quarter.

I tried this but it doesn't work:

sum({<Month={"=$(=Max(Month))"}>} sales)   // current month 

sum({<Month={"=$(=Max(Month)-1)"}>} sales) // previous month

 

 

 

 

 

2 Replies
shiveshsingh
Honored Contributor

Re: Dynamic Last Month of Current Quarter

Hi

 

You need to put a condition in set expression to get the current quarter too.

 

Like Quarter = {"$(=max(Quarter))"}

Shubham_Deshmukh
Valued Contributor

Re: Dynamic Last Month of Current Quarter

Don't know about exact requirement but it will you last month of current quarter and check whether it is first month of current quarter or not. If it is not first month then it will give you last month of CQ.

=Sum(if(monthname(today())<>monthname(QuarterStart(Today())), MonthName(QuarterEnd(today())),sale))

 

Hope it helps.

-Shubham