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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
y5famfnatudu
Helper III
Helper III

Ranking and Rolling Sums for huge dataset

Good morning,

 

I have a PBI report where raning and rolling sums are working fine, with about 25K records.

But when my table contains 180K records, then ranking and rolling sums time-out and don't work any more.

I would appreciate so much if you can guide me on solving this issue.

 

The Data sample and the PBI can be found here:

PBI 

Data 

 

Thank you so much.

Simon

1 ACCEPTED SOLUTION

@y5famfnatudu,

 

Here's a solution using calculated columns, but the downside is they don't recognize user selections (e.g., slicer). Thus, the ranking is based on all revenue, not revenue for a specific date range. Running totals in measures can have performance issues as data volume increases.

 

In the Contact table, create these calculated columns:

 

Total Revenue = CALCULATE( [_Revenue], RELATEDTABLE ( Sales ) )
Contact Rank = RANKX ( Contact, Contact[Total Revenue],, DESC, Dense )
Revenue Rolling = 
VAR vRank = Contact[Contact Rank]
VAR vResult =
    CALCULATE (
        SUM ( Contact[Total Revenue] ),
        ALL ( Contact ),
        Contact[Contact Rank] <= vRank
    )
RETURN
    vResult

 

Create measure:

 

_Revenue Rolling = SUM ( Contact[Revenue Rolling] )

 

DataInsights_0-1656338822386.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
v-henryk-mstf
Community Support
Community Support

Hi @y5famfnatudu ,

 

Rolling Sums for what?

 

Best Regards,
Henry

Hi @v-henryk-mstf 

 

Rolling sums for the revenue.

 

Best regards,

Simon

v-henryk-mstf
Community Support
Community Support

Hi @y5famfnatudu ,

 

I need to confirm with you that you want to add up the sums in order according to the ranking order, right? Looking forward to your reply.


Best Regards,
Henry

 

Hi @v-henryk-mstf ,

 

Exactly, the ranking is based on the desecnding order of the Revenue.

 

Best regards,

Simon

y5famfnatudu
Helper III
Helper III

I have changed the Ranking DAX formula to the following:

_ContactRank2 := 
RANKX (
    ALLSELECTED ( Contact[Debitor Nr] ),
    CALCULATE (
        SUM ( Sales[Revenue] ),
        ALLEXCEPT (
            Contact,
            Contact[Debitor Nr]
        )
    )
)

 Now, Ranking is working, but the Rolling Sum is still not

y5famfnatudu
Helper III
Helper III

@DataInsights Any ideas here? that would be so much appreciated.

@y5famfnatudu,

 

Here's a solution using calculated columns, but the downside is they don't recognize user selections (e.g., slicer). Thus, the ranking is based on all revenue, not revenue for a specific date range. Running totals in measures can have performance issues as data volume increases.

 

In the Contact table, create these calculated columns:

 

Total Revenue = CALCULATE( [_Revenue], RELATEDTABLE ( Sales ) )
Contact Rank = RANKX ( Contact, Contact[Total Revenue],, DESC, Dense )
Revenue Rolling = 
VAR vRank = Contact[Contact Rank]
VAR vResult =
    CALCULATE (
        SUM ( Contact[Total Revenue] ),
        ALL ( Contact ),
        Contact[Contact Rank] <= vRank
    )
RETURN
    vResult

 

Create measure:

 

_Revenue Rolling = SUM ( Contact[Revenue Rolling] )

 

DataInsights_0-1656338822386.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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