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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ajaffeeattmz
Frequent Visitor

Count Shipments with Multiple Sources

I am trying to use DAX to determine from a table with tracking messages which shipments have multiple sources and what percentage of the total shipments have multiple sources. 

There is not a row in the table that has both sources, each row has a unique source. 

 

My test data is below and the result I am expecting is 33% (Shipment #1 is the only shipment that fits the criteria over the 3 shipments). 

 

Shipment #Data Source
1EDI
1Track and Trace
2EDI
3Track and Trace

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@ajaffeeattmz Try this:

Measure = 
  VAR __Table = SUMMARIZE( 'Table', [Shipment], "__Count", COUNTROWS( 'Table' ) )
  VAR __TotalCount = COUNTROWS( __Table )
  VAR __CountMultiple = COUNTROWS( FILTER( __Table, [__Count] > 1 ) )
  VAR __Result = DIVIDE( __CountMultiple, __TotalCount )
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@ajaffeeattmz Try this:

Measure = 
  VAR __Table = SUMMARIZE( 'Table', [Shipment], "__Count", COUNTROWS( 'Table' ) )
  VAR __TotalCount = COUNTROWS( __Table )
  VAR __CountMultiple = COUNTROWS( FILTER( __Table, [__Count] > 1 ) )
  VAR __Result = DIVIDE( __CountMultiple, __TotalCount )
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

I think I am almost there. In the example below, two of the 9 shipments meet the conditions, so the % should be 22%. In the below it shows that all of the shipments meet the condition. Where am I going wrong? 

ajaffeeattmz_0-1727448408815.png

 

@Greg_Deckler 

 

I got it to work. I just needed to add a calculate and filter to my summarize table variable.

 

ajaffeeattmz_1-1727459908826.png

 

@ajaffeeattmz Can you share more/better representative data?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.