Forum Discussion
Anonymous
3 years agoNot applicable
Count differents values with condition
Hi, I need a help to create a colunm in DAX. The colunm "How many different hour" need to count how many different hours I have per "Type", for example: Type A have 2 different hours (20:20:53 ...
- Anonymous3 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated column.
Flag = var _table1= SUMMARIZE('Table','Table'[Type],'Table'[Hour]) return COUNTX( FILTER(_table1, [Type]=EARLIER('Table'[Type])),[Hour])2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
3 years agoNot applicable
Not sure if this is the most efficient solution but try this as calculated column,
CalculatedColumn =
var _Value = 'Table'[Type]
var _Table =
FILTER(
'Table',
'Table'[Type] = _Value
)
var _Result =
CALCULATE(
DISTINCTCOUNT('Table'[Hour]),
_Table
)
return _Result
- Anonymous3 years agoNot applicable
Hello Anonymous
Doesn't work, appears this message: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.