Forum Discussion
sqlguru448
6 years agoHelper III
DAX simple measure issue
Hello Folks, I have a simple DAX measure which counts the order keys based on the number of items below is the DAX. Order_20 = Calculate(DistinctCount('Fact Order'[Order_Key] | Filter('Fact O...
- 6 years ago
Try something like this:
Order_20 = COUNTX( DISTINCT( SELECTCOLUMNS( FILTER('Fact Order'[Items]<=20), "__Order_Key",[Order_Key] ) ), [__Order_Key] ) - 6 years ago
The "Filter" statement on a fact table that large will lead to performance issues. The good news is that you can use a simple filter in this CALCULATE formula instead. Try this:
Order_20 = CALCULATE ( DISTINCTCOUNT ( 'Fact Order'[Order_Key] ), 'Fact Order'[Items] <= 20 )
Thanks!
Matt Drabik
MDrabik
6 years agoAdvocate I
The "Filter" statement on a fact table that large will lead to performance issues. The good news is that you can use a simple filter in this CALCULATE formula instead. Try this:
Order_20 = CALCULATE ( DISTINCTCOUNT ( 'Fact Order'[Order_Key] ), 'Fact Order'[Items] <= 20 )
Thanks!
Matt Drabik