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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
anon23131213123
Microsoft Employee
Microsoft Employee

How to create a measure that excludes certain values

I am trying to create a measure that will count items that only have a single status. For example in the table below I am looking to only count InProgress items, Base2 would be excluded as it was InProgress but then tranisitioned to Aborted.  Using CALCULATE(COUNTROWS will give an answer of 3 as it will count Base1,Base2,Base3 as having a status of InProgress

 

ItemState
Base1InProgress
Base2InProgress
Base2Aborted
Base3InProgress
1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @anon23131213123 ,

 

How about this:

tomfox_0-1657810494636.png

 

 

Here the DAX:

MeasureCountStatus = 
VAR _helpTable =
SUMMARIZE (
    Table,
    Table[Item],
    "countNotInProgress", CALCULATE ( DISTINCTCOUNT ( Table[State] ), Table[State] <> "InProgress" ),
    "countInProgress", CALCULATE ( DISTINCTCOUNT ( Table[State] ), Table[State] = "InProgress" )
)
RETURN
CALCULATE ( COUNTROWS ( FILTER ( _helpTable, [countNotInProgress] = 0 && [countInProgress] = 1 ) ) ) 

 

Let me know if this works for you 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @anon23131213123 ,

 

How about this:

tomfox_0-1657810494636.png

 

 

Here the DAX:

MeasureCountStatus = 
VAR _helpTable =
SUMMARIZE (
    Table,
    Table[Item],
    "countNotInProgress", CALCULATE ( DISTINCTCOUNT ( Table[State] ), Table[State] <> "InProgress" ),
    "countInProgress", CALCULATE ( DISTINCTCOUNT ( Table[State] ), Table[State] = "InProgress" )
)
RETURN
CALCULATE ( COUNTROWS ( FILTER ( _helpTable, [countNotInProgress] = 0 && [countInProgress] = 1 ) ) ) 

 

Let me know if this works for you 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

That worked thanks!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.