Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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 adjust. Instead, take the actual credits.
So looking below, if the month is the current month (June 2025), then adjust my credits (-493,597) by the Sales Adjustment (550,000). Make the difference negative. The column "Credits Less Credit Adjustment" shows the correct value for each row, but the total is incorrect. It should be -950,387.36. I'm guessing because I'm not forcing the measure to be additive?
Here is my measure:
Solved! Go to Solution.
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.
Hi,
Drag this measure
=SUMX(VALUES(Calendar[Year-Mo]),[Credits less credit adjustment])
Hope this helps.
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.
Thank you so much! That did it!
Hi @Roseventura,
Can you please try the adjusted measure for "Credits Less Credit Adjustment" and let me know if this achieves your desired result:
Credits Less Credit Adjustment =
VAR CurrentMonth = [Current Year-Mo]
RETURN
SUMX(
VALUES(PBI_FSCAPF[YEAR-MO]),
VAR ThisYrMo = PBI_FSCAPF[YEAR-MO]
VAR Credit = CALCULATE([QTD Actual Credit Sales])
VAR Adj = CALCULATE([Selected Sales Adjustment])
RETURN
IF(
ThisYrMo = CurrentMonth,
Credit - Adj,
Credit
)
)
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson
Connect with me on LinkedIn
Check out my Blog
Going to the European Microsoft Fabric Community Conference? Check out my Session
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
55 | |
54 | |
54 | |
37 | |
29 |
User | Count |
---|---|
77 | |
62 | |
45 | |
40 | |
40 |