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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
StevenHiatt
Frequent Visitor

How to find distinct items where all detail meets specific criteria?

I have a set of data of sales orders. Each order may contain several items. Some items are listed on our website and others are not. I am trying to find the number of orders where ALL of the items on that order are web items?

 

Sample data:

Order# Item# Web Item?
Order1 Item1 1
Order1 Item2 0
Order2 Item3 1
Order3 Item1 1
Order3 Item4 1
Order3 Item5 1

 

In the data above, Orders 2 & 3 have all web items. How do I write a DAX formula to figure that out? (I've tried variations of DISTINCTCOUNT and SUMMARIZECOLUMNS but can't wrap my head around how to get it to work right. In Excel I can do a SUMIFS but that doesn't translate over to DAX.)

 

Thanks.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@StevenHiatt , Create a measure like below and plot with order # in visual or use as total

 


countx(filter(summarize(Table, Table[order#], "_1", count(Table[Item #]), "_2", calculate(count(Table[Item#]) filter(Table, Table[Web Item]=1))),
[_1] =[_2]), [order #])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@StevenHiatt , Create a measure like below and plot with order # in visual or use as total

 


countx(filter(summarize(Table, Table[order#], "_1", count(Table[Item #]), "_2", calculate(count(Table[Item#]) filter(Table, Table[Web Item]=1))),
[_1] =[_2]), [order #])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.