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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
y5famfnatudu
Helper III
Helper III

Rolling difference (measure)

Greetings,

I have a customer table with a measure computing the total revenue generated by each customer. Additionally, I've included a ranking column, sorting customers from the lowest to the highest revenue.

y5famfnatudu_0-1708338682994.png

I am seeking to create a new measure that calculates the percentage difference from the lowest revenue to the highest.

Kindly note that I can't create calculated columns

Best regards,
Simon

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@y5famfnatudu , Use offset function

 

Offset Previous Rank = CALCULATE(Sum([Revenue]),OFFSET(-1, ALL('Table'[Name],'Table'[Rank]),ORDERBY('Date'[Rank])))

 

 

You can then take a diff

sum(Table[Revenue]) - [Offset Previous Rank]

 

I assumed Revenue is a column, if it is measure no need for Sum

 

Continue to explore Power BI Offset Compare Categories, Time Intelligence MOM, QOQ, and YOY: https://youtu.be/5YMlkDNGr0U

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@y5famfnatudu , Use offset function

 

Offset Previous Rank = CALCULATE(Sum([Revenue]),OFFSET(-1, ALL('Table'[Name],'Table'[Rank]),ORDERBY('Date'[Rank])))

 

 

You can then take a diff

sum(Table[Revenue]) - [Offset Previous Rank]

 

I assumed Revenue is a column, if it is measure no need for Sum

 

Continue to explore Power BI Offset Compare Categories, Time Intelligence MOM, QOQ, and YOY: https://youtu.be/5YMlkDNGr0U

Thank you @amitchandak, but Rank is not a column in a table, rather a measure that I created.

__CustomerRank =
RANKX ( ALLSELECTED ( 'Customers' ), [Revenue],, ASC, DENSE )

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.