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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Good morning, I need a formula that does:
Total-Bonus
if this is equal to 0, returns the bonus value.
If this is different than zero then returns the next bonus value where this subtraction is equal to zero.
And a formula that does the same subtraction but returns the date instead of the bonus value.
| TOTAL | BONUS | DATE |
| 5 | 3 | 09/09/2022 |
| 5 | 2 | 10/09/2022 |
| 5 | 4 | 11/09/2022 |
| 5 | 5 | 12/09/2022 |
@felipesaw Maybe:
Measure =
VAR __Date = MAX('Table'[DATE])
VAR __T = MAX('Table'[TOTAL])
VAR __B = MAX('Table'[BONUS])
VAR __R = __T - __B
VAR __Table = ADDCOLUMNS(ALL('Table'),"__R",[TOTAL] - [BONUS])
RETURN
IF(__R = 0, __B, VAR __D = MINX(FILTER(__Table,[__R] = 0 && [DATE]> __Date),[DATE]) RETURN MAXX(FILTER(__Table,[DATE] = __D),[BONUS])
Hi friend, the measure almost worked perfectly, I ended up not making it clear, but I need it to bring the first value.
TOTAL BONUS DATE
| 5 | 3 | 09/09/2022 |
| 5 | 2 | 10/09/2022 |
| 5 | 4 | 11/09/2022 |
| 5 | 5 | 12/09/2022 |
| 6 | 5 | 13/09/2022 |
| 5 | 5 | 14/09/2022 |
In the table above for example, I have the date 9/14 that bonus=total, but before it came the date 9/12. So I need you to return the bonus amount of the 9/12 that came first.
I tried to fix the first measure, but withou sucess.
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 |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 31 | |
| 20 | |
| 12 | |
| 12 |