Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
davyqliks
Specialist
Specialist

Percentage difference of 2 expressions

Hi All,

I have a requirement to find the difference between 2 figures realised by expression:

I have tried Expression 1 - Expression 2 / Expression 2 but this does not give the same value as when i perform the same with the figures.

Here is my effort:

num (Sum({<[Month-Year] = {"$(=Date(Max({<HKD_Price *= {[*]}>}[Month-Year]), 'MMM-YYYY'))"}>} HKD_Price) -

Sum({<[Month-Year] = {"$(=Date(Max({<HKD_Price *= {[*]}>}[Month-Year]-1), 'MMM-YYYY'))"}>} HKD_Price) /

Sum({<[Month-Year] = {"$(=Date(Max({<HKD_Price *= {[*]}>}[Month-Year]-1), 'MMM-YYYY'))"}>} HKD_Price)

, '#,##0%')

 

Any advise on how i would achive the percentage difference between 2 sums  would be much appreciated.

Thank you in advance.

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

How about this

Num(

Sum({<[Month-Year] = {"$(=Date(Max({<HKD_Price *= {[*]}>}[Month-Year]), 'MMM-YYYY'))"}>} HKD_Price)
/
Sum({<[Month-Year] = {"$(=Date(Max({<HKD_Price *= {[*]}>}[Month-Year]-1), 'MMM-YYYY'))"}>} HKD_Price) - 1

, '#,##0%')

View solution in original post

4 Replies
sunny_talwar

How about this

Num(

Sum({<[Month-Year] = {"$(=Date(Max({<HKD_Price *= {[*]}>}[Month-Year]), 'MMM-YYYY'))"}>} HKD_Price)
/
Sum({<[Month-Year] = {"$(=Date(Max({<HKD_Price *= {[*]}>}[Month-Year]-1), 'MMM-YYYY'))"}>} HKD_Price) - 1

, '#,##0%')
davyqliks
Specialist
Specialist
Author

Thank you for the reply Sunny,

I  will try to implement this shortly and follow up.

Much appreciated

Daniel

 

davyqliks
Specialist
Specialist
Author

Thank you Sunny (Again),

Your assistance is so much appreciated.

Thank you

Daniel

davyqliks
Specialist
Specialist
Author

Hi Sunny,

I have found an issue with results of the above.

I have decided to simplify things a little and need to find the % different between 2 sums

sum({<[Year]={'2019'}>} [HKD_Price])

and

sum({<[Year]={'2018'}>} [HKD_Price]) 

The figures are as follows and so know the difference must like below

2760530389.02

1504520710.05

58.8978% difference

 

Please can you assist in the expression to reach this result?

Thank you in advance

Daniel