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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum elements from 2 different fields depending on a condition

Hi,

I have this flat table in my app in Qliksense: 

ProductsPriceCost
A56
B75
C42
D810

What I want is to have a single expression that can sum the larger of Cost or Price for all Products (essentially summing all the bold cell).

I was thinking of creating like a dummy table using aggr that produce something like this:

Productsmax(Price,Cost)
A6
B7
C4
D10

and just simply sum the Max(Price,Cost) field. But I haven't really come up with anything yet.

Please let me know if this is the right way or there is a better approach. Thanks!

1 Solution

Accepted Solutions
aarkay29
Specialist
Specialist

Try This

RangeMax(Price,Cost)

View solution in original post

2 Replies
aarkay29
Specialist
Specialist

Try This

RangeMax(Price,Cost)

Not applicable
Author

Thanks! I managed to use that in my data load editor as:

LOAD

...

RangeMax(Price,Cost) as MaxPC

...

And I just need to sum the MaxPC field as usual within the app. It works perfectly this way.