Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
wayne-a
Creator
Creator

Problem with pivot sort using set analysis

Hi I'm have an issue with sorting in a pivot table.  The table uses months for the columns and I would like the sort to be by the row values in the earliest month.  The measures are all calculating correctly, it is just the sort that is an issue.  In the example below, the two highlighted  rows should be reversed.  Below is the current sort expression, I understand what it is doing because it is calculating the count for the entire set of data, so when taking that into account, the order is correct.

Sort expression:

=Count(distinct {$<[Validity Component Result] = {'Abnormal'}, [Validity Test] = {'X'}>} [Order#])

Pivot Sort on Count.JPG

I changed the sort expression to the one below adding to the set analysis to take the min value of the month (bold text)

=Count(distinct {$<[Validity Component Result] = {'Abnormal'}, [Validity Test] = {'X'}, [Month Starting]= {"$(=Min([Month Starting]))"}>} [Order#])

But this gives the following result:

Pivot sort with min month.JPG

I think this may be happening because it has a problem with the expression overall and is defaulting to something else.

Thanks in advance for any input / help.

0 Replies