Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
juncco888
Advocate I
Advocate I

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

1 ACCEPTED SOLUTION
parry2k
Super User
Super 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
parry2k
Super User
Super 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.