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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LABrowne
Helper II
Helper II

Count formula: How to exclude values from count based on text

Hi there,

 

Currently have the below formula.

 

CALCULATE (
COUNT ( Table[Column] ),
filter('table',[SpicyLevel (%)] >1 &&[No. of Orders] >= 2 &&
TODAY () <= [Expiry Date Less 90 Days])
)

 

This works however I need to add another condition.

 

Orders that are cancelled will have "Cancelled" next to the order number. How to I add another condition to exclude text containing "Cancelled" within the Order[OrderNumber]?

 

Thanks,

Luke

2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

If I understood you problem you have data like this:

ValtteriN_0-1699461534244.png

You can add yet another condition with "&&"

As for the condition use functions like CONTAINSSTRING

Count not cancelled =
COUNTROWS(FILTER('Table (13)',
    NOT(CONTAINSSTRING('Table (13)'[OrderNumber],"Cancelled"))))

End result:
ValtteriN_1-1699462489934.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Amerluzz
New Member

Might not be the best way, but in PQE you can add a conditional column with a "Contains" clause. If Order Number contains "Cancelled" --> "Cancelled",  else --> "Active".

Then calculate your measure where your new column = "Active" 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.