Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
matthewjbryant
Creator II
Creator II

Multi-Dimension Aggr()

I'm trying to use the aggr() function with 2 or more dimensions in a chart, but can't get the result I want.

In the attached the totals are correct, but the average [Order Complete] only shows on one detail line per order (when it should show for all). I can't find how to change the aggr() so the detail and the totals are correct.

Any idea?

1 Solution

Accepted Solutions
sunny_talwar

Is this what you are looking for?

Capture.PNG

Try this expression:

=If(Dimensionality() = 0, sum(aggr(avg([Order Complete]),Order)), sum(aggr(NODISTINCT avg([Order Complete]),Order)))

HTH

Best,

Sunny

View solution in original post

8 Replies
robert_mika
Master III
Master III

What is your desired result?

sunny_talwar

Is this what you are looking for?

Capture.PNG

Try this expression:

=If(Dimensionality() = 0, sum(aggr(avg([Order Complete]),Order)), sum(aggr(NODISTINCT avg([Order Complete]),Order)))

HTH

Best,

Sunny

matthewjbryant
Creator II
Creator II
Author

Sorry if that wasn't clear. I want the detail from the table where that is correct (right), but with the totals showing as the table with the correct totals (left).

sunny_talwar

Forgot to add the attachment. PFA your qvw file for reference.

Best,

Sunny

matthewjbryant
Creator II
Creator II
Author

Yes!! I've no idea what this function's doing right now, but it's given me some new stuff to read up on!

Thanks

sunny_talwar

Hahahaha it sure does.

robert_mika
Master III
Master III

Do you mean Dimensionality?

Look here:

How to use - Dimensionality()

sunny_talwar

And you can learn about the concept about NODISTINCT here: What NODISTINCT parameter does in AGGR function?

Best,

Sunny