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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
hsiddiq
Frequent Visitor

Question Measure - Count SUM and Exclude from other status (Total Count)

Hi Team,

Have just started my PowerBi Journey, and have a Q.

 

I have 2 Columns. KeyValue and Status

KeyValue are Unique IDs

Status = Pending; Exception; Completed (see table below for details)

 

Question?

How can I calculate System Exception SUM(total) Keyvalues (execlude if they already in COMPLETE status)

 

KeyValueStatus
ID- 111System Exception
ID- 111Business Exception
ID- 111 - ReviewCompleted
ID- 222 - ReviewCompleted
ID- 333Completed
ID-444System Exception
ID-555System Exception
ID-666Business Exception

 

Results (Pie Chart) 
Completed (with Review in KeyValue) =2
System Exception = 2
Business Exception =1
Total KeyValue = 6
1 ACCEPTED SOLUTION

I'd suggest making a new column that only includes the elements that have the uniqueness you want.  I'd suggest doing this in Power Query. Then just update the provided code to work how you need it.

View solution in original post

5 REPLIES 5
RossEdwards
Solution Sage
Solution Sage

Create 2 different measures.  The first measure is your base measure which will do the sum/count etc.  It might be something like:

Total Records = COUNTROWS('Your Table Name')

(this will give you a record count, alternatively you could use DISTINCTCOUNT('Your Table Name'[KeyValue]) if you want uniques only


Next you'll write a measure that calls the base measure but excludes items you don't want:

Count excluding completed = CALCULATE(
    [Total Records],
    'Your Table Name'[Status] <> "Completed"
)

 

 

Hello @hsiddiq ,

 

it's true as @RossEdwards , but it could be written as one measure, no need for two measures

Count excluding completed = CALCULATE(
    countrows('YourTableName'),
    'Your Table Name'[Status] <> "Completed"
)

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Don't write it as one measure.  If you do that you will get the wrong answers in certain aggregation situations.
@hsiddiq @Idrissshatila 

Thanks Ross, Your method works fine, with one slight issue (which I think I didn't explain properly because the table was confusing). the Unique ID when completed has this added ID- 111 - Review Status= Completed. So what I need to do is Compare the ID with removing the "- Review" part if it has. (sometimes it will not have that) hope this makes sense, and apologies my last table made it a bit confusing.

I'd suggest making a new column that only includes the elements that have the uniqueness you want.  I'd suggest doing this in Power Query. Then just update the provided code to work how you need it.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors