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
nikkirai
Frequent Visitor

Running Percentages DAX Power BI

Hi all,

 

I'm trying to get running percentages for this dummy dataset based on a real dataset:

 

MemberID, PortfolioID

1,1

1,2

1,3

1,4

1,5

1,6

1,7

1,8

1,9

1,10

2,1

2,2

2,3

 

I want to add another column [Running Percentages] to this dataset as below:

MemberID, PortfolioID, RunningPercentage

1,1, 10%

1,2, 20%

1,3, 30%

1,4, 40%

1,5, 50%

1,6, 60%

1,7, 70%

1,8, 80%

1,9, 90%

1,10, 100%

2,1, 33%

2,2, 66%

2,3, 100%

In SQL, there is the percentile_rank, but how do I do this in Power BI?

Thank you!

1 ACCEPTED SOLUTION
andhiii079845
Super User
Super User

Try this:
 
Measure =
VAR _group = CALCULATE(max('Table'[MemberID]))
VAR _max = CALCULATE(DISTINCTCOUNT ('Table'[PortfolioID]),FILTER(ALLSELECTED('Table'),'Table'[MemberID]=_group))
 RETURN RANKX(CALCULATETABLE('Table','Table'[MemberID],'Table'[PortfolioID],'Table'[MemberID]=_group),CALCULATE(sum('Table'[PortfolioID])),,ASC)/_max 
 
andhiii079845_0-1679342565783.png

 





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
andhiii079845
Super User
Super User

Try this:
 
Measure =
VAR _group = CALCULATE(max('Table'[MemberID]))
VAR _max = CALCULATE(DISTINCTCOUNT ('Table'[PortfolioID]),FILTER(ALLSELECTED('Table'),'Table'[MemberID]=_group))
 RETURN RANKX(CALCULATETABLE('Table','Table'[MemberID],'Table'[PortfolioID],'Table'[MemberID]=_group),CALCULATE(sum('Table'[PortfolioID])),,ASC)/_max 
 
andhiii079845_0-1679342565783.png

 





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

Proud to be a Super User!




It works perfectly. Thank you!

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.