Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hey, I need help with a simple formula. At first glance dax I wrote it is simple and in the lines it works correctly however the sum no longer match.
The formula is supposed to search for the max date with the data and subtract the previous day, but since the lines have different max dates, I want the sum of these differences, not the total for example 05.02 - 04.02
As in the image below from the green values, the red values should be subtracted. The expected result for the total is 55, with -125 received, for obvious reasons.
Thanks for help
Solved! Go to Solution.
I resolves problem myself ny using
SUMX(
SUMMERIZE(
Sales,Sales[Client],"Sum",CALCULATE(SUM(Sales[Value]),Sales[Date]=MAX(Sales[Date]))),Sum)
_
SUMX(
SUMMERIZE(
Sales,Sales[Client],"Sum",CALCULATE(SUM(Sales[Value]),Sales[Date]=MAX(Sales[Date])-1)),Sum)
I resolves problem myself ny using
SUMX(
SUMMERIZE(
Sales,Sales[Client],"Sum",CALCULATE(SUM(Sales[Value]),Sales[Date]=MAX(Sales[Date]))),Sum)
_
SUMX(
SUMMERIZE(
Sales,Sales[Client],"Sum",CALCULATE(SUM(Sales[Value]),Sales[Date]=MAX(Sales[Date])-1)),Sum)
@Adamkowalsky92 , Can you share formula which you have used
Proud to be a Super User! |
|
Parameter define how much days i want back
@Adamkowalsky92 Try using
dax
VAR maxday = MAX(Sales[Day])
VAR beforeday = CALCULATE(MAX(Sales[Day]), Sales[Day] < maxday)
VAR sales = CALCULATE(SUM(Sales[Value]), Calendar[Date] = maxday)
VAR salesbefore = CALCULATE(SUM(Sales[Value]), Calendar[Date] = beforeday)
RETURN
SUMX(
VALUES(Sales[Day]),
sales - salesbefore
)
Proud to be a Super User! |
|
Unfortunately, this is not a suitable solution:
1. you have not added a parameter option that defines the value by a certain number of days
2. I want the sum of only one day, not all earlier than max date
Hi @Adamkowalsky92 ,
I tried to reproduce your visual object, but was unsuccessful. However, I think this problem can be solved quickly. To better help you solve the problem, could you provide some example pbix? Thank you very much for your cooperation!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 19 | |
| 17 | |
| 11 |