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
Hi All,
Need help on DAX for the below scenario
1.Need to calculate Cumulative total for Amount based on Lapse Yr and Sponsor
2.BEY-Cumulative total>0 (first postive value) need to show corresponding Lapse Yr for Sponsor,if Cumulative total<0 then 11
Expected Result:
Thanks,
Sanjay
hello,
Here's the step-by-step approach:
Assumptions:
You have a table named "Transactions" that contains the columns: "Amount," "Lapse Yr," and "Sponsor."
Step 1: Create a calculated column for Cumulative Total
First, you need to create a calculated column that calculates the cumulative total for each combination of Lapse Yr and Sponsor. This can be done using the FILTER and EARLIER functions.
Cumulative Total =
CALCULATE(
SUM('Transactions'[Amount]),
FILTER(
ALL('Transactions'),
'Transactions'[Sponsor] = EARLIER('Transactions'[Sponsor]) &&
'Transactions'[Lapse Yr] <= EARLIER('Transactions'[Lapse Yr])
)
)
Step 2: Create a calculated column for BEY-Cumulative Total
Next, you can create another calculated column to identify the first positive value in the Cumulative Total and show the corresponding Lapse Yr for the Sponsor.
BEY-Cumulative total =
VAR CumulativeTotal = [Cumulative Total]
VAR PositiveTotal =
CALCULATE(
MIN('Transactions'[Lapse Yr]),
FILTER(
ALL('Transactions'),
'Transactions'[Sponsor] = EARLIER('Transactions'[Sponsor]) &&
[Cumulative Total] > 0
)
)
RETURN
IF(CumulativeTotal > 0, PositiveTotal, BLANK())
In this formula, we use a variable CumulativeTotal to store the Cumulative Total for each row and then find the first positive Cumulative Total value for the Sponsor using the FILTER function.
Step 3: Result
Now, your table should have two additional calculated columns: "Cumulative Total" and "BEY-Cumulative total." The "BEY-Cumulative total" column will show the corresponding Lapse Yr for the Sponsor when the Cumulative Total is greater than zero.
Remember, these calculated columns will be computed for each row in the table, so the result will be dynamic based on the data in the "Transactions" table.
Note: If you want to avoid using calculated columns and want to show these values as measures, the approach will be slightly different. Let me know if that's the case, and I can provide the measure-based approach as well.
Hi Vaibhav,
Thanks for reply,if we created as you suggested in table is not giving expected result because we have other filters like country etc is not applied ,So same sponser can have multiple country
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 |
|---|---|
| 12 | |
| 9 | |
| 9 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 20 | |
| 18 | |
| 12 |