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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
lost_rabbit
Contributor III
Contributor III

Find Total Price of Top Ranked Customers in a dynamic date range

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)

 

 

 

 

 

Labels (1)
1 Solution

Accepted Solutions
lost_rabbit
Contributor III
Contributor III
Author

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

 

 

View solution in original post

3 Replies
Chanty4u
MVP
MVP

Can you try this

={<Customer = {"=Rank(Sum({<yrweek ={'$(= '>=' & Concat(DISTINCT yrweek, "','") & '<=')" >}Price) * .90 + Sum({<yrweek ={'<=$(=Max(yrweek))'}>}Price)) <= 5"}>}

lost_rabbit
Contributor III
Contributor III
Author

Getting errors with this formula 

lost_rabbit
Contributor III
Contributor III
Author

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