Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Looking to see if a Dax measure can be written so that the values displayed in a matrix will only be affected by specific slicers for each measure.
Matrix would look like:
Sales Agent | Apples Orders Placed Count | Sold Apples Order Count
Dave Smith | 200 | 150
DAX:
Solved! Go to Solution.
Hi @Marc_Ponick ,
Please have a try.
Apple Orders Placed Count - This measure will only be influenced by the 'Placed Year' slicer:
Apple Orders Placed Count =
CALCULATE(
DISTINCTCOUNT('Inventory Data'[Order ID]),
'Inventory Data'[Fruit] = "Apples",
'Inventory Data'[Placed] = "True",
ALLEXCEPT('Inventory Data', 'Inventory Data'[Placed Year])
)
Sold Apple Orders Count- This measure will only be influenced by the 'Sold Year' slicer:
Sold Apple Orders Count =
CALCULATE(
DISTINCTCOUNT('Inventory Data'[Order ID]),
'Inventory Data'[Fruit] = "Apples",
'Inventory Data'[Sold] = "True",
ALLEXCEPT('Inventory Data', 'Inventory Data'[Sold Year])
)
The ALLEXCEPT function keeps the filters for the specified columns and removes all other context filters from the table. This way, each measure will only respond to its respective slicer.
ALLEXCEPT function (DAX) - DAX | Microsoft Learn
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Marc_Ponick ,
Please have a try.
Apple Orders Placed Count - This measure will only be influenced by the 'Placed Year' slicer:
Apple Orders Placed Count =
CALCULATE(
DISTINCTCOUNT('Inventory Data'[Order ID]),
'Inventory Data'[Fruit] = "Apples",
'Inventory Data'[Placed] = "True",
ALLEXCEPT('Inventory Data', 'Inventory Data'[Placed Year])
)
Sold Apple Orders Count- This measure will only be influenced by the 'Sold Year' slicer:
Sold Apple Orders Count =
CALCULATE(
DISTINCTCOUNT('Inventory Data'[Order ID]),
'Inventory Data'[Fruit] = "Apples",
'Inventory Data'[Sold] = "True",
ALLEXCEPT('Inventory Data', 'Inventory Data'[Sold Year])
)
The ALLEXCEPT function keeps the filters for the specified columns and removes all other context filters from the table. This way, each measure will only respond to its respective slicer.
ALLEXCEPT function (DAX) - DAX | Microsoft Learn
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.