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

Problem using the set analysis

Hi,

I have a bar chart showing the total sales for each year (X-dimension = Years, Y-dimension = Total amount of sales). In the raw data set/database, i have the total amount of sales for each quarter. Fyi, one year is divided into 4 quarters. If i would like to show the total amount of sales for the last two quarters only of each year, how should i accomplish it using the set analysis? Why the below set expression does not work?

sum( {$<QUARTER={$(=Max(QUARTER)), $(=Max(QUARTER))-1}>}  AMOUNT)

Thanks much in advance for your help!

GK

5 Replies
Not applicable
Author

Hi,

You can right the expression like below:-

Sum({$<QUARTER={"$(=Max(QUARTER))"}+{"$(=Max(QUARTER)-1)"}>}AMOUNT)

Hope this helps.

Cheers,

DJ

Not applicable
Author

Thanks DJ ... Have tried but it does not work. Thanks.

Not applicable
Author

Can you pls share the sample application?

Not applicable
Author

Hi, kindly please find the attached file. I would like to have the chart to show the total sales amount of the last two quarters (Quarter 3 and Quarter 4) for each Year. So, in my example, Fiscal Year 2011 should show 700 (300 + 400), Fiscal Year 2010 should show 1500 (700 + 800). Thanks.

gussfish
Creator II
Creator II

OK, firstly, your field is called FISCAL_QUARTER, not QUARTER, so that's

what you need in your expression to fix your problem.

But then, why use MAX at all? You could just use

{<FISCAL_QUARTER={3,4}>}

The only reason to use MAX is if you want it to sum the last 2 of the

selected quarters. e.g. if the user has explicitly selected quarters 1,

2 & 3, then it will sum Quarters 2 & 3. If that's what you intend, then

yes, do use MAX. Otherwise, hardwire the values.