Forum Discussion
Anonymous
5 years agoNot applicable
Choose earliest value as true value
Hi, I'm stuck on this annoying problem. I would like to indicate where the highest cost arises based on - NAME - ALIAS - BRANCH - MONTH Now my following MAX(COST)-column makes the follow...
parry2k
Super User
5 years agoAnonymous here is the measure and the result
Max Cost =
VAR __table =
ALLEXCEPT (
'Cost',
'Cost'[MONTH],
'Cost'[NAME],
'Cost'[ALIAS],
'Cost'[BRANCH]
)
VAR __id =
CALCULATE (
MIN ( Cost[ID] ),
TOPN ( 1, __table, CALCULATE ( MAX ( Cost[COST] ) ), DESC )
)
VAR __return =
IF ( MIN ( Cost[ID] ) = __id , 1 )
RETURN __return
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Anonymous
5 years agoNot applicable
When I try the code it just gives me the circular reference error. How can that be?
- v-henryk-mstf5 years ago
Community Support
Hi Anonymous ,
You need to copy the code to measure instead of calculated column.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.