Forum Discussion
raymond
Post Patron
8 years agoCount 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" occur...
- 8 years ago
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" ) )
Zubair_Muhammad
Community Champion
8 years ago
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" ) )
Zubair_Muhammad
Community Champion
8 years ago
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" ) )