Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 Eric_Tay
		
			Eric_Tay
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		
Dear all,
Notice that when we sort using expression in Pivot Table, sometime the sorting is incorrect.
In below example, I would like to sort the Year, Division and Category dimensions using Sum(LineSalesAmount). When I expand the Division column, notice that the Sum(LineSalesAmount) for Year 2012 are not sorted properly, as shown below:
 
 
When I expand the Division and Category columns, notice that the Sum(LineSalesAmount) are not sorted properly, as shown below:

Below is my sorting tab:

Any tips how to sort the Year, Division and Category dimensions using sum(LineSalesAmount) correctly?
Regards,
Eric
 
					
				
		
 amit_saini
		
			amit_saini
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Eric,
Could you please share your application.
Thanks,
AS
.png) 
					
				
		
 Miguel_Angel_Ba
		
			Miguel_Angel_BaHi,
Are you using the same expression to sort all three dimensions?
Miguel
 rubenmarin
		
			rubenmarin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Eric,
I don't have a complete answer, I can tell you this is done because QV assigns the order to the field CategoryName before he draws the pivot table, so segment dimensions (Year and Division) are not taking into account.
Sportswear is the 2nd. in Europe because the value 'Sportswear' of the field CategoryName is the 2nd with more sales on current selections (not in the year-Division in pivot table)
If you define the 3rd dimension as =Aggr(Year & '-' & Division & '-' & CategoryName, Year, Division, CategoryName) you can see then is sorted correctly, but this cause your selections in CategoryName not working as the user probably wants (not to mention the bad-looking for the CategoryName)
In script you can use Dual(CategoryName, AutoNumber(Year & '-' & Division & '-' & CategoryName)) as CategoryName but weird things also can happen with selections.
Hope this helps you to find a solution.
 
					
				
		
 Eric_Tay
		
			Eric_Tay
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Miguel,
Yes, I am using the same expression to sort all three dimensions.
Eric
 
					
				
		
 Eric_Tay
		
			Eric_Tay
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Amit,
Here is the file:
Thanks,
Eric
 
					
				
		
 Eric_Tay
		
			Eric_Tay
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks Ruben,
Let me try it and I will let you know whether it works or not.
Eric
