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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
raymond
Post Patron
Post Patron

Count if a value occurs in multiple columns per row

Dear Community,

 

Initial Situation:

There is a table of multiple columns: btn_A to btn_D. 

 

Sought Output as a new column:

The function should count how often a value such as "Interest" occurs in multiple columns. See Count_Interest

 

How can this be achieved?

 

2018-02-11 18_55_36-Mappe1 - Excel.png

1 ACCEPTED SOLUTION

@raymond

 

Similarly

 

Count_Conversion =
VAR RowValues =
    UNION (
        ROW ( "MyTable", TableName[btn_A] ),
        ROW ( "MyTable", TableName[btn_B] ),
        ROW ( "MyTable", TableName[btn_C] ),
        ROW ( "MyTable", TableName[btn_D] )
    )
RETURN
    COUNTROWS ( FILTER ( RowValues, [MyTable] = "Conversion" ) )

View solution in original post

3 REPLIES 3
MARSU95
Regular Visitor

Hello, 
I treied this but didn't work in power Query neither in DAX 😕

Zubair_Muhammad
Community Champion
Community Champion

@raymond

 

Try As a caclulated column

 

Count_Interest =
VAR RowValues =
    UNION (
        ROW ( "MyTable", TableName[btn_A] ),
        ROW ( "MyTable", TableName[btn_B] ),
        ROW ( "MyTable", TableName[btn_C] ),
        ROW ( "MyTable", TableName[btn_D] )
    )
RETURN
    COUNTROWS ( FILTER ( RowValues, [MyTable] = "Interest" ) )

 

 

@raymond

 

Similarly

 

Count_Conversion =
VAR RowValues =
    UNION (
        ROW ( "MyTable", TableName[btn_A] ),
        ROW ( "MyTable", TableName[btn_B] ),
        ROW ( "MyTable", TableName[btn_C] ),
        ROW ( "MyTable", TableName[btn_D] )
    )
RETURN
    COUNTROWS ( FILTER ( RowValues, [MyTable] = "Conversion" ) )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.