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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.