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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
cdp_cre
Contributor
Contributor

Peculiar multiplication with IF nested

Hi, I want to ask how it's possibile to obtain a new calculated measure (called "TREND") that is obtained this way:

1) if the row for the month in "VALORE 2021" is not 0 then it's equal to "BUDGET PESATO"  * "DELTA % SUL MESE" both for the month where this condition is true

2) if the row for the month in "VALORE 2021" is 0 then the value is obtained for this month by multiplying "BUDGET PESATO" of this month and "DELTA % SUL MESE" value of the latest month when "DELTA % SUL MESE" was different from zero.

Thanks a lot.

cdp_cre_0-1620897393261.png

 

2 Replies
Anil_Babu_Samineni

Perhaps this?

Sum(Aggr(If([VALORE 2021]<>0, "BUDGET PESATO"*"DELTA % SUL MESE",
If([VALORE 2021]=0, RangeSum(Sum({<MESE={$(=AddMonths(Max({<"DELTA % SUL MESE"={"=Sum("DELTA % SUL MESE")<>0"}>}MESE),-1))}>} "DELTA % SUL MESE"),Sum({<MESE={$(=Max(MESE))}>} "BUDGET PESATO"))), DIPARTIMENTO))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
cdp_cre
Contributor
Contributor
Author

Thanks a lot but I solved differently using nested above and if.