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

Fractile

Hi at all,

I have this situation

Products    Quantity    Unit Price    Total Amount

Product A    100          10                1000

Product B    50              5                  250

Product A    50            10                  500

Product C    10              4                    40

..

..

..

Then i calculated the total amount for each product with this formula

aggr( sum(Unit_Price * Quantity),Product)

Then i would like to calc the fractile 25% using this formula

fractile(TOTAL aggr( sum(Unit_Price * Quantity),Product),0.25)


Now i would like to select a product and still obtain the correct value of fractile and so i tried with this formula

fractile(TOTAL {<Product>} aggr( sum(Unit_Price * Quantity),Product),0.25)


But if i select a product the value of fractile change and it shows me the total amount.

How can i solve it?

Andrea

1 Solution

Accepted Solutions
YoussefBelloum
Champion
Champion

Hi, try this:

fractile(TOTAL {<Products>} aggr( sum({<Products= >}[Unit Price] * Quantity),Products),0.25)

View solution in original post

5 Replies
Anil_Babu_Samineni

What if your removed TOTAL in your last expression

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
YoussefBelloum
Champion
Champion

Hi, try this:

fractile(TOTAL {<Products>} aggr( sum({<Products= >}[Unit Price] * Quantity),Products),0.25)

sunny_talwar

youssefbelloum‌ is right, in order to ignore selection in Product field, you need to ignore the selection in Products in not only your outer aggregation, but also the inner Sum()

andrea90casa
Creator
Creator
Author

Hi Youssef,

Thanks for your help. I have tried with {<Product>} inside the sum() but it didn't give to me the correct value but then i found my error....i was not considering a second field and so the value of fractile was wrong.

Thanks againg

Andrea

YoussefBelloum
Champion
Champion

you're welcome !

don't forget to close the Thread