Forum Discussion
DAX : SUM is wrong in matrix
- 3 years ago
pls try this
Hi marakud ,
It seems like you are trying to calculate sales with a filter on a specific value. However, the total is not showing the correct value in the matrix. One possible reason for this could be that the filter context is not being applied correctly. You may want to try using the ALL function to remove the filter context from the calculation. Here is an example of how you could modify your measure:
Sales =
VAR _SALES = CALCULATE ( SUM ( 'Ca Réalisé'[Sales] ) )
VAR _SALES_NOPROD =
CALCULATE (
SUM ( 'Ca Réalisé'[Sales] ),
T_DIM_PLAN2_NIV3[P2_NIV3_LIBELLE] <> "PROD SEULEMENT"
)
RETURN
IF (
ISFILTERED ( Etablissement[Name] ),
CALCULATE(_SALES_NOPROD, ALL(Etablissement[Name])),
_SALES
)
This should remove the filter context from the calculation and give you the correct total in the matrix.
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 ! thanks for your answer.
I tried your solution but no changes.
here the demo file : https://we.tl/t-dyunwmyxrA
thanks again.
Best