Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
serge__g
Contributor III
Contributor III

Order by in Pivot table Qlik Sense

Hi,
in my pivot table I have customer lines and column years. I would like to make a descending sorting on the sales on the greatest year selected.

by putting {2018} it's ok but how to set the max date selected :

sum({$<[DateFacture.autoCalendar.Year]={2018}>} [Sales]))

 

Regards

6 Replies
Uday_Pasupuleti
Partner - Creator III
Partner - Creator III

Try {"$(=Max(Year))"}

JordyWegman
Partner - Master
Partner - Master

Hi Serge,

Try this:

 

sum({$<[DateFacture.autoCalendar.Year]={"$(=Max(Year))"}>} [Sales])

 

Jordy

Climber 

Work smarter, not harder
serge__g
Contributor III
Contributor III
Author

thanks for your help, but when i replace {2018} by  {"Max(Year)"} -->  

sum({$<[DateFacture.autoCalendar.Year]={"Max(Year)"}>} [Sales])

I dont have the order by by the max year selected (2016 / 2017 / 2018) and i dont have all register of years selected 

Thanks

JordyWegman
Partner - Master
Partner - Master

Hi Serge,

I updated the function. This function will automatically select the maximum year. When you select 2016 & 2017, it will select 2017, because that is then currently the max year. For this you don't need the order by.

Jordy

Climber

Work smarter, not harder
serge__g
Contributor III
Contributor III
Author

Sorry but I do not really understand your feedback. I thing we have a little misunderstanding. I will try to clarify my issue.

I have a pivot table with customer names on the row and years ( from 2000 up to 2019) on the column. Values inside the pivot table are customer turnover.

Questions :

When I select for example 3 years ( 2016 2017 2018 ), I would like to rank in decreasing order the customer column according to their turnover. This classification must be done on the most recent year. In this case 2018.
Actually my fonction is --> sum({$<[DateFacture.autoCalendar.Year]={2018}>} [Sales])
And i don't want {2018} buta pamameter of the max of the year selected
Hope that my comments can help.

Best regards
JordyWegman
Partner - Master
Partner - Master

Hi Serge,

This is indeed something different then I had in mind. But pivot tables are sorted, and only sorted based on the first column. When you use Customer names as the first one, it will always sort based on the Customer names.

When you want to achieve this, you should use a normal table with your sort.

Jordy

Climber

Work smarter, not harder