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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Hamdan1234
Helper III
Helper III

Calculation of Row total as Percentage

I want to get row total as percentage only not whole row as percentage in a matrix. But I want the percentage based on row filled or not if there are two cells in a row  and both cell are filled then it should show row total as 100% and if one cell is filled and  other is empty it should show 50% similarly out of three cells if two cells are filled row total should be 33%.

I am attaching the data as well as the result I am getting along with desired outcome. Hoping for the answer.

Thanks

DateNames
02/03/2021John
02/03/2021Aliana
02/03/2021Amily
02/03/2021Faby
02/03/2021John
02/03/2021Aliana
02/03/2021Amily
02/03/2021Aliana
02/03/2021Amily
02/03/2021Faby
03/03/2021Faby
03/03/2021Sheam
03/03/2021Aliana
03/03/2021Amily
03/03/2021Aliana
03/03/2021Amily

 

tempsnip.png

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Hamdan1234 this will do it, 

 

Measure = 
VAR __total = CALCULATE ( DISTINCTCOUNT ( data[Date] ), ALLSELECTED ( ) ) 
VAR __name = CALCULATE ( DISTINCTCOUNT ( data[Date] ), REMOVEFILTERS ( data[Date] ) ) 
RETURN 
DIVIDE ( __name, __total )

 

@amitchandak  measure will need change.

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@Hamdan1234 this will do it, 

 

Measure = 
VAR __total = CALCULATE ( DISTINCTCOUNT ( data[Date] ), ALLSELECTED ( ) ) 
VAR __name = CALCULATE ( DISTINCTCOUNT ( data[Date] ), REMOVEFILTERS ( data[Date] ) ) 
RETURN 
DIVIDE ( __name, __total )

 

@amitchandak  measure will need change.

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@Hamdan1234 , a measure like

 

divide(countrows(Table), calculate(countrows(Table), removefilters(Table[Date]))

I have modified it little bit after seeing that this measure was showing in each column so keep it to one at last I have made it like below:

Measure2 =
VAR __total = CALCULATE ( DISTINCTCOUNT ( Sheet1[Date] ), ALLSELECTED ( ) )
VAR __name = CALCULATE ( DISTINCTCOUNT ( Sheet1[Date] ), REMOVEFILTERS ( Sheet1[Date] ) )
RETURN
IF(
ISFILTERED(Sheet1[Date]),
BLANK(),
DIVIDE ( __name, __total ))

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors