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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mic_rys
Helper I
Helper I

Count values different than

Hi, i need a daxhero! 
I need to count Orders with a specific color and without it.

 

OrderIDColorProductValues
111BlueProd11
111BlueProd22
111RedProd35
111GreenProd12
222RedProd24
222GreenProd36
333RedProd11
333RedProd22
333BlueProd35
333GreenProd12

 

For measure with color is easy:

BlueOrder = CALCULATE(DIstinctCount(OrderID), Color = "Blue")
Result is: 2 (ID 111 and 333)

But how to write measure for orders without Blue?
NoBlueOrder = ?
Result shoult be: 1 (ID 222)
 
i might add that it's live connection to SSAS tabular.
thank you in advance
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @mic_rys 

Please kindly check the below.

The sample pbix file's link is down below.

 

Picture5.png

 

Without Blue =
VAR bluetable =
SUMMARIZE (
FILTER (
SUMMARIZE ( 'Table', 'Table'[OrderID], 'Table'[Color] ),
'Table'[Color] = "Blue"
),
'Table'[OrderID]
)
VAR alltable =
VALUES ( 'Table'[OrderID] )
RETURN
COUNTROWS ( EXCEPT ( alltable, bluetable ) )

 

https://www.dropbox.com/s/jw8dfslfo4zte4j/mic%20rys.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @mic_rys 

Please kindly check the below.

The sample pbix file's link is down below.

 

Picture5.png

 

Without Blue =
VAR bluetable =
SUMMARIZE (
FILTER (
SUMMARIZE ( 'Table', 'Table'[OrderID], 'Table'[Color] ),
'Table'[Color] = "Blue"
),
'Table'[OrderID]
)
VAR alltable =
VALUES ( 'Table'[OrderID] )
RETURN
COUNTROWS ( EXCEPT ( alltable, bluetable ) )

 

https://www.dropbox.com/s/jw8dfslfo4zte4j/mic%20rys.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

thank you a lot, works perfectly!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.