Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Try this
Only({<Quarter, Month, Year>} Aggr(NODISTINCT Sum({<Quarter, Month, Year>} Sales), Year))
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.
Like this?
vSales =Sum(TOTAL {<Quarter=,Month=, Year=>}Sales).
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
Try this
Only({<Quarter, Month, Year>} Aggr(NODISTINCT Sum({<Quarter, Month, Year>} Sales), Year))
Or, try this:
vSales = Aggr( NODISTINCT Sum({<Quarter=,Month=, Year=>}Sales),Year)
Thanks for the reply expert! Why we use only given it's still working after removing it? Thanks!
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.
Hi Sunny,
Thanks for your Support.
I achieved my Scenario using this example.
Thanks & Regards,
Lakshman