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
Mahamil2
New Member

Measure to count text values in a column

Hello.  I am new to Power BI & DAX.  I am using Power BI to create visualizations based on the results of Quality Assurance tests I have performed.  My data set consists of a list of vendors and various test elements which receive either a "Yes", "No" or "n/a" rating.   I would like to create a measure that counts the # of times Yes and n/a occur in each column. 

I will then be dividing that # by the total # of vendors tested (or total rows) in order to obtain a score. 

In Excel i used the following formula, =SUMPRODUCT(COUNTIF(B2:B12,{"Yes","n/a"}))/COUNTA(B2:B12)  but cannot figure out a similar formula to use in Power BI.  Additionally, in Excel I was able to copy and paste this formula to each column to calculate a score for each test element; is there a way to create a measure in Power BI and apply it to each test element/column or would i need to create a measure for each column?

Thank you for any help you can provide  🙂

 

testdata.JPG

 

 

 

1 ACCEPTED SOLUTION
MariaP
Solution Supplier
Solution Supplier

After importing your data perform transformations via the backend.

Unpivot all the Element columns (Select Vendor the use Unpivot all others)

in Advanced Grouping - > group by Vendor and Result

 

 

This will give you the final Count you are afterVendor.PNG

Downlaod Sample PBIX: Vendor Download

View solution in original post

2 REPLIES 2
MariaP
Solution Supplier
Solution Supplier

After importing your data perform transformations via the backend.

Unpivot all the Element columns (Select Vendor the use Unpivot all others)

in Advanced Grouping - > group by Vendor and Result

 

 

This will give you the final Count you are afterVendor.PNG

Downlaod Sample PBIX: Vendor Download

Thank you Maria!  This provided the solution i needed. 

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.