cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

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
Highlighted
Microsoft
Microsoft

Re: Calculating percentages and distinct counts

@creynolds,

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
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021