Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

how to highlight Top 3 Hour Sales by Region in PIVOT Table?

Hi all, 

I have a PIVOT adhoc table, its Sales by Region by Hour. now, user request, when i select dimension - Region, i can see Region A, top 3  sales by hour are:  06:00 - $1000, 14:00 - $5000, 18:00 - $15000, so these 3 values will be highlighted. 

But i got it wrong. seems like my script  is showing me the TOP 3 Region which has the Top 3 sales by EVERY hour. 

My expected result is: Region A, top 3  sales by hour are:  06:00 - $1000, 14:00 - $5000, 18:00 - $15000, so these 3 values will be highlighted.

I have 2 dimensions - Region & Hour. 

variable: vP1AvgSales

background expression: If(Rank(Total Count(vP1AvgSales))<4,RGB (255,0,0))   - which i think is wrong.

jim_chan_1-1654759718461.png

 

Please help guys!

 

Rgds

 

Jim

 

 

 

 

 

 

7 Replies
vinieme12
Champion III
Champion III

Try

=Aggr(if(Rank(Sum(Sales),4,1)<=3,red()),Hour,Region)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
jim_chan
Specialist
Specialist
Author

I have tried with the script given .  but turned out not the result i was expecting.  this script highlighted  each hours, top 3 sales region.

jim_chan_0-1654761304777.png

 

but my expected result is: Region A, top 3  sales by hour are:  06:00 - $1000, 14:00 - $5000, 18:00 - $15000, so these 3 values will be highlighted.

 

vinieme12
Champion III
Champion III

try below

=if(HRANK(sum(Sales),4,1)<=3,red())

 

or

=Aggr(if(Rank(Sum(Sales),4,1)<=3,red()),Region,Hour)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
jim_chan
Specialist
Specialist
Author

i am sorry Vinneth, i have already tried with both. but still the same result. not as expected. 

Anyway, is there a way not to highlight the Totals? 

 

jim_chan_0-1654775723861.png

 

 

Rgds

 

Jim

vinieme12
Champion III
Champion III

You can use 

If(rowno()<>0, if(your rank ❤️ expression,then color) )

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
jim_chan
Specialist
Specialist
Author

HI Vineeth, 

tried with that too . but still the same. I have added this script, in the Region properties - Background expression.. 

If(rowno()<>0,

Aggr(if(Rank(COUNT(vAvgSales),4,1)<=3,white()),HOUR,Region))

 

jim_chan_0-1654827640164.png

 

Rgds

 

Jim

vinieme12
Champion III
Champion III

using HRANK( )

=If(rowno()<>0,    // IF NOT TOTAL ROW

if(HRank(COUNT(vAvgSales),4,1)<=3,  RED() )   //  THEN ONLY COLOR Dimension rows 

) //END IF

 

OR AGGR()

If(rowno()<>0,

if(Aggr(Rank(COUNT(vAvgSales),4,1),HOUR,Region)<=3, RED() ) )

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.