Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
spinchuk
Partner - Contributor III
Partner - Contributor III

Sum based on maximum value of flag

Hi guys,

I have data like this:

EstimateVersionAmount
a1123
a2136
b152

I need help with formula that will calculate "Latest" column in the PIVOT table like below:

EstimateOriginalLatest
a123136
b5252

My current expression for "Original" is Sum({$<Version = {1}> Amount} work fine.

But my Expression for "Latest" Sum({$<Version = {$(=Max(Version))}>}Amount) does not work, because the Max(Version) = 2 for both estimates. Since estimate b does not have version 2 - i'm getting blank.

Any help please?

Thank you

1 Solution

Accepted Solutions
Not applicable

Attached with answer.Hope it helps

Thanks

View solution in original post

3 Replies
Not applicable

Attached with answer.Hope it helps

Thanks

spinchuk
Partner - Contributor III
Partner - Contributor III
Author

Ajay, thank you, that works.

However my sub total for each category stopped working...

My actual results looks like this:

EstimateCategoryOriginalLatest
acat1123136
cat227
cat338
Total128151
bcat15252
cat255
Total5757

When I implemented FirstSortedValue(), the numbers in "Latest" column are correct, but Total now "-".

Thank you

Not applicable

For subtotals use dimensionality () and kinda play arund with the formyula