Forum Discussion
vincentakatoh
6 years agoHelper IV
Count Multiple Columns
Hi, Need help to count the part usage. Below is sample data, Case_Number PartNumber_Part replace_1st PartNumber_Part replace_2nd PartNumber_Part replace_3rd PartNumber_Part replace_4th P...
az38
6 years agoCommunity Champion
maybe it can look like a measure
Measure =
var PartNumber = MAX(Table[PartNumber_Part replace_1st])
RETURN
CALCULATE(COUNTROWS(Table), FILTER(ALL(Table), Table[PartNumber_Part replace_1st] = PartNumber)) +
CALCULATE(COUNTROWS(Table), FILTER(ALL(Table), Table[PartNumber_Part replace_2st] = PartNumber)) +
CALCULATE(COUNTROWS(Table), FILTER(ALL(Table), Table[PartNumber_Part replace_3st] = PartNumber)) +
CALCULATE(COUNTROWS(Table), FILTER(ALL(Table), Table[PartNumber_Part replace_4st] = PartNumber)) +
CALCULATE(COUNTROWS(Table), FILTER(ALL(Table), Table[PartNumber_Part replace_5st] = PartNumber))
then leave in the visual [PartNumber_Part replace_1st] field and new measure
vincentakatoh
6 years agoHelper IV
Thanks. Nonetheless, the original data has 100s of different part number. Writing each "part number" in the DAX will be difficult or impossible.
Rgds, Vincent