Forum Discussion
Derekp978
6 years agoFrequent Visitor
Calculate Transactions Per Order
All - I have a simple data set that looks like the following - and we are looking for Avg Transactions Per Order (For all orders that remain unfiltered completely) Order ID Transaction ID Tr...
- Anonymous6 years ago
// (ABS) means "absolute", so // that you know filters do not // affect this number. [Avg Tx Per Order (ABS)] = var __txCount = CALCULATE( // Since the table T has a // unique column of transactions... COUNTROWS( T ), VALUES( T[OrderID] ), ALL( T ) ) var __orderCount = DISTINCTCOUNT( T[OrderID] ) var __result = DIVIDE( __txCount, __orderCount ) return __result
Greg_Deckler
Community Champion
6 years agoDerekp978 - Use ALL or ALLEXCEPT to ignore filter context.
- Derekp9786 years agoFrequent Visitor
That was my thought but when I applied it it didn't work - if I want to IGNORE these three filters is this correct?
Avg Transactions per Order := DIVIDE(CALCULATE(COUNT([TRANSACTION ID]), ALL([FILTER 1],[FILTER 2], [FILTER N])),DISTINCTCOUNT([Order ID]))
- Anonymous6 years agoNot applicable
// (ABS) means "absolute", so // that you know filters do not // affect this number. [Avg Tx Per Order (ABS)] = var __txCount = CALCULATE( // Since the table T has a // unique column of transactions... COUNTROWS( T ), VALUES( T[OrderID] ), ALL( T ) ) var __orderCount = DISTINCTCOUNT( T[OrderID] ) var __result = DIVIDE( __txCount, __orderCount ) return __result