Forum Discussion
Measure instead of Custom Column
I have a custom column I created in power query that assigns a "meets" or "exceeds" value based on the conditions in several other columns.
The M looks like this:
Custom Column
= IF ([Case Status] = "Open" and [typename]="Orders" and [lengthcaseopen] > 4 and Text.Contains([accountname],"Distrib") then "Exceeds" else "Meets")
Case Status, typename, lengthcaseopen, and account name are all in the same table.
The M above correctly created a column with the correct values in each row.
However, I feel like there is a way I could do this better with a measure but everything I attempt does not work.
Basically, I would like a measure that checks the conditions above and if they are all met gives me a count of the number of rows that meet all those conditions. I realize I would not have the meets value but all I really need is a count of the exceeds (rows that meet all the conditions).
Any ideas?
Thanks
Kyle
juncco888 I think doing this in PQ is ok, and then you can add a measure to count for "Exceeds" using following measure:
Exceeds Count = CALCULATE ( COUNTROWS ( YourTable ), YourTable[YourColumn] = "Exceeds" )✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) 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.⚡
2 Replies
- parry2kSuper User
juncco888 I think doing this in PQ is ok, and then you can add a measure to count for "Exceeds" using following measure:
Exceeds Count = CALCULATE ( COUNTROWS ( YourTable ), YourTable[YourColumn] = "Exceeds" )✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) 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.⚡
- juncco888Advocate I
Thank you very much! The measure you provided solved the issue. I appreciate it. Do you think my custom column and your measure is the best choice performance wise? I was worried about the extra custom column in a direct query situation.
Thanks Again!
Kyle