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: 
Not applicable

Aggregation along a selected dimension

Stupid question, I am sure...

I'd like to understand how I can sum the Bill amount (see table below) by selecting the dimension along which I'd like to aggregate.

In plain english, this would be: "sum the Billing amount by distinct Order ID (to avoid summing up every rows"

Expected answer = 100 + 200 + 400 = 700

Who can help me get the right syntax?

Order IDItem nameItem QTYItem priceBill amount
B1Item A120100
B1Item B240100
B1Item C240100
B2Item A240200
B2Item D1160200
B3Item A120400
B3Item B240400
B3Item E4340400
4 Replies
Nicole-Smith

sum(aggr(only([Bill amount]),[Order ID]))

Not applicable
Author

Hi,

you can use sum(DISTINCT Bill Amount)

Not applicable
Author

Hey Jean,

I this the final view of the table?  Can you post an example of how the final table will look like. What all dimensions and expressions if different from this. Or do you want this 700 in a text box?

You can try   sum(aggr(sum(distinct Bill amount),OrderID)) 

This will work in Text Box perfectly but in table it will cause nulls for everything bur first Order ID but total will be correct.

It depends on where you want the result.

Nicole-Smith

Torsten Rehder's solution will only work if two Order ID's never have the same Bill Amount.