Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Lakshman_1031
Partner - Contributor
Partner - Contributor

Find the Quarter wise % values

Hi All,

I have 3 years and having Quarters.

How to calculate the percentage values in Quarter wise.

I have used Sum(Sales)/$(vSales)

Note: vSales ==Sum({<Quarter=,Month=, Year=>}Sales).

If i select the one percentage values are changed.

for example if i select 2019 then Quarters % values are changed. then clear it will change % values.

How to find the correct % values for Year wise and over all.

please find the below example for your reference.

please suggest me how to achieve this scenario.

Thanks & Regards,

lakshman

2 Solutions

Accepted Solutions
sunny_talwar

Try this

Only({<Quarter, Month, Year>} Aggr(NODISTINCT Sum({<Quarter, Month, Year>} Sales), Year))

View solution in original post

sunny_talwar

In this particular case it is working because the numerator of your expression is still not ignoring selection which is why having Only with set analysis makes no difference, but if for some reason you wanted your chart to ignore selection in Quarter, Month, Year field... and your expression was this

Sum({<Quarter, Month, Year>}Sales)/$(vSales)

then you would have needed

Only({<Quarter, Month, Year>} Aggr(NODISTINCT Sum({<Quarter, Month, Year>} Sales), Year))

But because your Numerator is just Sum(Sales), it doesn't matter if Denominator ignores selection in Quarter, Month, Year or not... I would use what @tresesco has provided in this case.

View solution in original post

7 Replies
tresesco
MVP
MVP

Like this?

 vSales =Sum(TOTAL {<Quarter=,Month=, Year=>}Sales).

Lakshman_1031
Partner - Contributor
Partner - Contributor
Author

Hi Tresesco,

Thanks for your Quick response.

i have used Sum(TOTAL {<Quarter=,Month=, Year=>}Sales).

but Year wise values are wrong.

for example year 2020 and Q 1 having 23.9 but in chart having 8 %.

please see the below example for your reference.

Please suggest me how to achieve this scenario.

Thanks & regards,

Lakshman

 

sunny_talwar

Try this

Only({<Quarter, Month, Year>} Aggr(NODISTINCT Sum({<Quarter, Month, Year>} Sales), Year))
tresesco
MVP
MVP

Or, try this:

 

vSales = Aggr( NODISTINCT Sum({<Quarter=,Month=, Year=>}Sales),Year)

 

alex00321
Creator II
Creator II

Thanks for the reply expert! Why we use only given it's still working after removing it? Thanks!

sunny_talwar

In this particular case it is working because the numerator of your expression is still not ignoring selection which is why having Only with set analysis makes no difference, but if for some reason you wanted your chart to ignore selection in Quarter, Month, Year field... and your expression was this

Sum({<Quarter, Month, Year>}Sales)/$(vSales)

then you would have needed

Only({<Quarter, Month, Year>} Aggr(NODISTINCT Sum({<Quarter, Month, Year>} Sales), Year))

But because your Numerator is just Sum(Sales), it doesn't matter if Denominator ignores selection in Quarter, Month, Year or not... I would use what @tresesco has provided in this case.

Lakshman_1031
Partner - Contributor
Partner - Contributor
Author

Hi Sunny,

Thanks for your Support.

 

I achieved my Scenario using this example.

 

Thanks & Regards,

Lakshman