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
Anonymous
Not applicable

Calculating percentages and distinct counts

I'm looking for a way for Power BI to calculate percentages by comparing two #'s together.    I'm also looking for a way these two #'s are the results of a distinct count.    Example, column #1 has 6 occurrences of the word "Red"; column #2 has 2 occurrences of the word "Blue".    I'd like the column #3 and #4 display the output ("6" and "2") and finally, column #5 and #6 display the percentage of occurrence that Red and Blue appear in the list.   I need for the report to dynamically calculate as there will be a slicer in this report which will drive the content to filter on.       

1 REPLY 1
v-yuezhe-msft
Employee
Employee

@Anonymous,

Please check if the following DAX return your expected result. If not, please help to share sample data of your table.

Column3 = CALCULATE(COUNTA(Table[Column1]),FILTER(Table,Table[Column1]="Red"))
Column4 = CALCULATE(COUNTA(Table[Column2]),FILTER(Table,Table[Column2]="Blue"))
% of Red = Table6[Column3]/COUNT(Table6[Column1])
% of Blue = Table6[Column4]/COUNT(Table6[Column2])
1.PNG

Regards,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors