The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
33 | |
13 | |
12 | |
9 | |
7 |