Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Assuming the current yrweek is 202314, apply a fall down % (10%) for future weeks. That is, if the yrweek for the order is <= 202314 then use price. If the yrweek is greater than 202314, then reduce it by 10%.
I need a KPI to display the total price of top 5 customers after applying fall down calculation
This formula works when no yrweek filters are selected
={<Customer = {"=Rank(Sum({<yrweek ={"">202314""} >}Price) * .90 + Sum({<yrweek ={""<=202314""} >}Price) ) <= 5"}>}
Sum ({<yrweek ={">202314"} >} Price) * .9 + Sum ({<yrweek ={"<=202314"} >} Price)
However when a user selects, say 202310,202312, 202322 and 202325 in the yrweek filter, this formula doesn't update because I have used yrweek in the set expressions.
How do I write the same formula so that it is dynamic and updates based on user selected yrweek values. Eg, for the above four weeks selected, find top 5 customers after applying the fall down % and return the total price (with fall down % applied)
Update. Using Asterix solved it
={<Customer = {"=Rank(Sum({<yrweek *={"">202314""} >}Price) * .90 + Sum({<yrweek *={""<=202314""} >}Price) ) <= 5"}>} Sum ({<yrweek *={">202314"} >} Price) * .9 + Sum ({<yrweek *={"<=202314"} >} Price)
Thanks to this thread
https://community.qlik.com/t5/QlikView-App-Dev/Modifier-as-initial-filter/td-p/1633065
You can read more about it in detail here
https://community.qlik.com/t5/Design/Implicit-Set-Operators/ba-p/1475624
Can you try this
={<Customer = {"=Rank(Sum({<yrweek ={'$(= '>=' & Concat(DISTINCT yrweek, "','") & '<=')" >}Price) * .90 + Sum({<yrweek ={'<=$(=Max(yrweek))'}>}Price)) <= 5"}>}
Getting errors with this formula
Update. Using Asterix solved it
={<Customer = {"=Rank(Sum({<yrweek *={"">202314""} >}Price) * .90 + Sum({<yrweek *={""<=202314""} >}Price) ) <= 5"}>} Sum ({<yrweek *={">202314"} >} Price) * .9 + Sum ({<yrweek *={"<=202314"} >} Price)
Thanks to this thread
https://community.qlik.com/t5/QlikView-App-Dev/Modifier-as-initial-filter/td-p/1633065
You can read more about it in detail here
https://community.qlik.com/t5/Design/Implicit-Set-Operators/ba-p/1475624