Forum Discussion
123abc
2 years agoCommunity Champion
Required Dax Correction / Help
Hi Experts, I have to measuere one is current month month to date sales "[CM MTD Sales]" 2nd is Qualified Units "[Qualified Units]" about two measure related to two differnect tables like sales...
talespin
2 years agoSolution Sage
Hi 123abc ,
This is how your measure is currently working.
At row level there is a filter coming from visual, but at total level there is no filter from visual.
So TotalSum = 2986 and TotalQualified = 4277, that is why you are getting total as TotalSum.
IF(
TotalQualified > TotalSum,
TotalSum,
0
)
Use SUMX to fix this. and call your measures inside SUMX and pass the filters manually(though filters are propagated automatically during context transition).
Please refre to this article.
Update :
Something like this, Since SUMX is an iterator. It will iterate over all products and return value based on your condition. Also your measure invokes context transition and will calculate for each product.
Modify Summarize to modify the filters(Example I see Party and Branch as filters in screenshot).
SUMX(
SUMMARIZE(DimProduct, DimProduct[EnglishProductName]),
VAR TotalSum = [MCustomQuantity]
VAR TotalQualified = [MQuantity]
RETURN
IF(
TotalSum = TotalQualified,
TotalSum,
IF(
TotalSum > TotalQualified,
TotalQualified,
IF(
TotalQualified > TotalSum,
TotalSum,
0
)
)
)
)
If still any issue, please share pbix file with any sensitive data removed.
123abc
2 years agoCommunity Champion
Thank You very much for your kind replay, if i have any issue regarding this then i will provide you sample data and further explanations.