Forum Discussion
count multiple from multiple columns into one
- 9 years ago
Hey,
I'm not sure if this is exactly what you are looking for, the result of the measure looks promising
Here is the measure
Measure = SUMX( UNION( SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim1]), SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim2]), SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim3]), SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim4]) ) ,IF([ContainsA] = "A", 1, 0))Basically this measure creates a table for each row (maybe you have to put CALCULATE() to its magically use if your table and model much more complex than my simple model.
Than SUMX iterates over the 4 ROWS and sums the result.I created a measure but this should also be usable by creating a calculated column.
Cheers
[note to myself: Compare Multiple Columns]
- 9 years ago
Hey,
I got other measure formula
Here is the measure
Measure2 = IF(Table1[DIM1]="A",1,0)+
IF(Table1[DIM2]="A",1,0)+
IF(Table1[DIM3]="A",1,0)+
IF(Table1[DIM4]="A",1,0)Thanks for you help.
Hey,
I'm not sure if this is exactly what you are looking for, the result of the measure looks promising
Here is the measure
Measure =
SUMX(
UNION(
SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim1]),
SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim2]),
SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim3]),
SELECTCOLUMNS('Table1',"ContainsA", 'Table1'[Dim4])
)
,IF([ContainsA] = "A", 1, 0))Basically this measure creates a table for each row (maybe you have to put CALCULATE() to its magically use if your table and model much more complex than my simple model.
Than SUMX iterates over the 4 ROWS and sums the result.
I created a measure but this should also be usable by creating a calculated column.
Cheers
[note to myself: Compare Multiple Columns]
Hey,
I got other measure formula
Here is the measure
Measure2 = IF(Table1[DIM1]="A",1,0)+
IF(Table1[DIM2]="A",1,0)+
IF(Table1[DIM3]="A",1,0)+
IF(Table1[DIM4]="A",1,0)
Thanks for you help.