Forum Discussion
Sum the line items based on condition
- 3 years ago
Try
Total Days = SUMX ( 'Table', IF ( 'Table'[Hours] > 0, 1 ) )
I wouldn't do that as a measure, I would do it as a calculated column.
The easiest way would be to use Power Query to add a conditional column and use the "begins with" operator.
You could also use Power Query to create a new column by extracting the first N characters from the employee code. You could then create a table containing all the countries and the digit codes and link them in a one-to-many relationship which you could use as a slicer or filter
So we should not create measure for such a case?
- johnt753 years agoSuper User
I wouldn't, no. A measure is typically an aggregation of a value, e.g. the sum or the average. You can't aggregate a country, and typically you would want to use such a thing to slice or filter some measures. Better to have something like that in a column.