Forum Discussion

Mahamil2's avatar
Mahamil2
New Member
8 years ago
Solved

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  :)

 

 

 

 

  • 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 after

    Downlaod Sample PBIX: Vendor Download

2 Replies

  • MariaP's avatar
    MariaP
    Icon for Solution Supplier rankSolution 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 after

    Downlaod Sample PBIX: Vendor Download

    • Mahamil2's avatar
      Mahamil2
      New Member

      Thank you Maria!  This provided the solution i needed.