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
Anonymous
Not applicable

Distinct Count with Condition

Hi Experts , I have Order Number with Status as 1 and 0 , Few Order can have status as 0 or 1 both ,
I need to get the distinct Count of Order Number where Order is only 1 

For below tables, I need Output as 2 , Since one Order-1 has both 0 and 1 and it should not be considered for Disctinct count 
Order.PNG

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Create a measure like

countx(filter(summarize(Table, Table[order], "_1", DistinctCount(Table[flag])), [_1]<2),[order])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi,Thanks for the Quick Reply, But i see that code does not Check if Only FLAG=1 Order are considered, I do not want to pick order where Flag=0 has appeared.
It would fail in below scenario.
Order.PNG

Still the Expected O/P is Distinct Count Should be 2 

I tired below code which helped 

DistinctCountOrders-Summarize =
COUNTX (
FILTER (
SUMMARIZE ( Order, Order[Order], "oFlag", MIN( Order[Flag] ) ),
[oFlag] =1
),
Order[Order]
)

 

 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

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!

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.

Users online (25)