Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
eddywong71
Creator
Creator

How to extract last month's value for every Quarter

Hi All,

Same as below link.

https://community.qlik.com/t5/App-Development/How-to-extract-last-month-s-value-for-every-Quarter/td...

I want to create a line Chart only Show  Q1 = Mar2023  Q2 = Jun2023, Q3 =Sep2023, Q4 = Dec2023 just like below 

eddywong71_0-1692156655264.png

By using 

Dimension:

Dual('Q'&Num(Ceil(Num(Month(InvDate))/3)),Num(Ceil(NUM(Month(InvDate))/3),00))

Measure:

Sum({<InvId = {'=Month(InvDate)=Month(QuarterEnd(InvDate))'}>}Sales)

OR

Sum(If(Month(InvDate)=Month(QuarterEnd(InvDate)),Sales,0)).

 

However The Line Chart sum with all the year. I want the Line chart have two line

Current Year , Last Year. like below picture

eddywong71_0-1692171064184.png

 

 

how should i revise the measure.

Can anyone help?

 

1 Reply
Lakshmanan
Partner - Contributor III
Partner - Contributor III

Hi , 
Create two different measures for Current year and previous year and add them in measures .
SUM({$<Year={'$(=Year(Today()))'}>} Sales)   // sales for current Year
SUM({$<Year={'$(=Year(Today())-1)'}>} Sales) // sales for previous Year