Forum Discussion
Smartnag
4 years agoFrequent Visitor
In Statement in sql, same in power bi
Hi All,
Need help on below.
=Max([CD] In ([Bookinghour]) ) is in SQL.
Both CD and Bookinghour are the columns.
Same how to achieve in Dax.
Thanks,
Nag
- Anonymous4 years ago
Hi Smartnag,
Did you mean to get the 'CD' value based on the max 'bookinghours', right?
If that is the case, you can get the max 'bookinghours' first, then you can use this as a condition to find out the CD value.formula = VAR maxHour = CALCULATE ( MAX ( Table[Bookinghour] ), ALLSELECTED ( Table ) ) RETURN CALCULATE ( MAX ( Table[CD] ), FILTER ( ALLSELECTED ( Table ), [Bookinghour] = maxHour ) )Regards,
Xiaoxin Sheng
2 Replies
- AnonymousNot applicable
Hi Smartnag,
Did you mean to get the 'CD' value based on the max 'bookinghours', right?
If that is the case, you can get the max 'bookinghours' first, then you can use this as a condition to find out the CD value.formula = VAR maxHour = CALCULATE ( MAX ( Table[Bookinghour] ), ALLSELECTED ( Table ) ) RETURN CALCULATE ( MAX ( Table[CD] ), FILTER ( ALLSELECTED ( Table ), [Bookinghour] = maxHour ) )Regards,
Xiaoxin Sheng