Qlik Community

Qlik Catalog

Discussion Board for collaboration on Qlik Catalog

cancel
Showing results for 
Search instead for 
Did you mean: 
ismasani
Contributor
Contributor

How to get percentage Difference

Hi Everyone.

I nee one help.. I calculate a Difference Between Current Year Sale and Last Year

like..

num(Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={">=$(vCurrentYear)"}>}[_volume_SO]),'##.0')-  num(Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={">=$(vPreviousYear)<=$(vPreviousYear)"}>}[_volume_SO]),'##.0')

so I m getting and answer Suppose.. This Year sale is 100 Rs and Last Year sale was 50 Rs.. so total growth 50 Rs.. But I want to show growth in %.. in this case my Revenue growth is 50 %.. because it got double from last year..

Please help me how to do this

Labels (1)
4 Replies
PrashantSangle

what is the error you are getting?? 

Great dreamer's dreams never fulfilled, they are always transcended.
MayilVahanan

Hi @ismasani 

Try like below to get percentage

num((Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={"$(vCurrentYear)"}>}[_volume_SO])- Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={"$(vPreviousYear)"}>}[_volume_SO]))/

Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={"$(vPreviousYear)"}>}[_volume_SO]),'#,##0.#0%')

Thanks & Regards,
Mayil Vahanan R
Kushal_Chawda

@ismasani  try below

=(Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={">=$(vCurrentYear)"}>}[_volume_SO])-  
Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={">=$(vPreviousYear)<=$(vPreviousYear)"}>}[_volume_SO]))
/
Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={">=$(vCurrentYear)"}>}[_volume_SO])
danny59486
Contributor
Contributor

Hello,

Please try this below code.

 

sum({$<Year = {$(=max(Year)-1)}>}Price_Pcs_Incl_Discount) - sum({$<Year = {$(=max(Year))}>}Price_Pcs_Incl_Discount)) to show growth in % in this case my Revenue growth is 50 % because it got double from last year.