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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
amishra01
Regular Visitor

Rank by Grouping of multiple columns

Hi All,

 

I have a scenario where I have3 years of Data and on that i need to Calculate Rank the prices by Date and Location column.

The Granularity of data is hourly , so per day for each location I have prices for 24 hours.

 

My requirement is rank the prices for each day by mktlocation . I tried  using

top4 =
VAR RANK_ = RANKX(ALL(Table[Date],table[Location]),CALCULATE(SUM(table[TotalPrice])),,DESC)
//returns top 4 months only
RETURN
CALCULATE ( MAX ( 'Table'[TotalPrice]), FILTER ( 'Table', RANK_ <= 4 ) )

 

This code gives me error -This visual has exceeded the available resources". 

 

I also tried grouping on model level but the result never showed up for me.

 

Any help would be really appreciated.

1 ACCEPTED SOLUTION
olgad
Super User
Super User

Hi, 

RANKX(
      CROSSJOIN(
        ALL('Table'[Location]),
        ALL('Table'[Date])),

      [Total Price]
)

Please calculate total price as a separate measure
Total Price= SUM(Total Price)

DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

View solution in original post

1 REPLY 1
olgad
Super User
Super User

Hi, 

RANKX(
      CROSSJOIN(
        ALL('Table'[Location]),
        ALL('Table'[Date])),

      [Total Price]
)

Please calculate total price as a separate measure
Total Price= SUM(Total Price)

DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.