Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

incorrect % value given

Dear experts,

I am trying to get a % value out of an expression, however I do believe there is some faults with my coding. Below I will provide the expression as well as the logic I am trying to achieve.

the requirements: (revenue from previous year / revenue this year) - 1

Formula/Script:

(Sum({<BDF_Type = {"Revenue"}, [year] = {"$(=Max([year])-1"}>} cash)    /      Sum({<BDF_Type = {"Revenue"}, [year] = {"$(=Max([year])"}>} cash) ) -1

The individual components of expression work, however when put together to acquire the ratio, they seem to be calculating the wrong values. Cheers !

11 Replies
PrashantSangle

Hi,

In your denominator expression you have written same expression as numerator that why you are getting 100 % Check again

Below expression are you looking for

=num(Sum({<BDF_Type = {"Revenue"}, [year] = {"$(=Max([year])-1)"}>} cash)/Sum({<BDF_Type = {"Revenue"}, [year] = {"$(=Max([year]))"}>} cash), '###.00%')

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunny_talwar

dreamer4‌ has correctly pointed out the issue, isn't it?

Capture.PNG

Once I changed to Max(Year) in the set analysis for denominator, it seems to be all working?