Forum Discussion
Roseventura
Responsive Resident
1 year agoIncorrect Totals when adjusting the value based on Year-Mo
Hi all, I'm having a very common problem but can't get the correct results. Basically, I need to adjust my credits if the month is the current month. If it's not the current month, then don't a...
- 1 year ago
Hi Roseventura
In DAX, when you use SUMX(VALUES...), the calculation is done row by row... even for totals. thats why you get wrong values.
Try the following DAX... it should fix your problemCredits Less Credit Adjustment = SUMX ( ADDCOLUMNS ( VALUES ( PBI_FSCAPF[YEAR-MO] ), "AdjustedCredit", IF ( [YEAR-MO] = [Current Year-Mo], -([Selected Sales Adjustment] + [QTD Actual Credit Sales]), [QTD Actual Credit Sales] ) ), [AdjustedCredit] )Best Regards,
hnam_2006
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hnam_2006
1 year agoFrequent Visitor
Hi Roseventura
In DAX, when you use SUMX(VALUES...), the calculation is done row by row... even for totals. thats why you get wrong values.
Try the following DAX... it should fix your problem
Credits Less Credit Adjustment =
SUMX (
ADDCOLUMNS (
VALUES ( PBI_FSCAPF[YEAR-MO] ),
"AdjustedCredit",
IF (
[YEAR-MO] = [Current Year-Mo],
-([Selected Sales Adjustment] + [QTD Actual Credit Sales]),
[QTD Actual Credit Sales]
)
),
[AdjustedCredit]
)
Best Regards,
hnam_2006
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Roseventura
Responsive Resident
1 year agoThank you so much! That did it!