I'm stuck on this annoying problem. I would like to indicate where the highest cost arises based on
Now my following MAX(COST)-column makes the following calculation:
And my INDICATOR-column then makes it as a "1" if the entry is the maximum.
I have following table
But, I only want my INDICATOR to count the earliest MAX-value, i.e. the second "620" given the same filters should just be blank as following:
As you can se from the table MAX(COST) is blank for ID='3'. How do I make sure my INDICATOR takes this into account?
Thanks in advance.
@martin1212 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.⚡
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
When I try the code it just gives me the circular reference error. How can that be?
Hi @martin1212 ,
You need to copy the code to measure instead of calculated column.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
What if I don't have an ID-column? How should I then approach it? I know it sounds silly, but making this code work without using the ID would be better in my case 🙂
Find out more about the May 2023 update.
Share your Data Story with the Community in the Data Stories Gallery.