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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sheikhbiuser
Regular Visitor

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

@sheikhbiuser , Create a measure like

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors