Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Kodafixed
Contributor
Contributor

Roll Up Totals in Chart Based on Multiple Selected Values

I have a BI dashboard that needs to show the Top 10 performing customers based on the viewer's selection of date(s) and area(s). The underlying table data stores the Sales Period (YYYY-MM), Sales Area, Customer Name, and the total invoiced revenue from them for that period.

 

ExampleData:
LOAD INLINE [
Period|Area|Customer|Sales
2021-01|North|ABC Corp|1,000,000
2021-02|North|XYZ Co|1,500,000
2021-01|South|ABC Corp|2,000,000
2021-02|North|XYZ Co|950,000
...
] (DELIMITER IS '|');

 

In my straight table chart I have a calculated field to get the top-10 customers by sales and it seems to work if the user selects at least 1 and only 1 of either|both Period & Area, but if they select multiples of either or select none of either it breaks.

 

= MONEY(
    AGGR( IF( RANK(TOTAL SUM({<[Customer Name]>} [Customer Sales])) <= 10, [Customer Sales]), [Customer Sales])
    , '$ #,##0'
)

 

What I am needing the chart to do is, if the user selects multiple Periods &/or Areas, or none of either, that the top-10 returned is the "aggregate" sum of all Periods/Dates in the current selection as a single entry.

I've been googling and reading solutions for the last day and none of what I'm finding addresses this issue. Thanks in advance!

1 Solution

Accepted Solutions
Kodafixed
Contributor
Contributor
Author

Fixed it!

= IF( AGGR(RANK(SUM(Sales)), Customer) <= 10
	, AGGR(SUM(Sales), Customer)
	, Null()
)

View solution in original post

1 Reply
Kodafixed
Contributor
Contributor
Author

Fixed it!

= IF( AGGR(RANK(SUM(Sales)), Customer) <= 10
	, AGGR(SUM(Sales), Customer)
	, Null()
)