Forum Discussion
ajaffeeattmz
1 year agoFrequent 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...
- 1 year ago
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
Greg_Deckler
1 year agoCommunity 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
__Resultajaffeeattmz
1 year agoFrequent Visitor
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?
- Greg_Deckler1 year agoCommunity Champion
ajaffeeattmz Can you share more/better representative data?
- ajaffeeattmz1 year agoFrequent Visitor
I got it to work. I just needed to add a calculate and filter to my summarize table variable.