Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |