Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have data that looks like
For a given date, I want to calcualte the sum where buckets are greater than equal to current bucket.
bucket = ON, 1M, 2M, .... and they are sorrted using column BucketDisplayOrder
RefDtAsDate | BucketDisplayOrder | Bucket | Total | Run Total Negated |
30-Sep-23 | 1 | ON | - 15,214,480,007 | 13,506,905,040 |
30-Sep-23 | 2 | 1M | - 4,009,095,472 | 4,325,658,564 |
30-Sep-23 | 3 | 2M | - 2,340,791,557 | 2,340,701,152 |
30-Sep-23 | 4 | 4M | 316,698,698 | - 316,743,901 |
31-Aug-23 | 1 | ON | - 12,025,581,264 | 3,925,291,987 |
31-Aug-23 | 2 | 1M | - 2,573,944,777 | - 441,874,669 |
31-Aug-23 | 3 | 2M | - 2,068,740,731 | 2,068,650,386 |
31-Aug-23 | 4 | 4M | - 3,015,683,930 | 3,015,638,757 |
31-Jul-23 | 1 | ON | - 15,045,532,484 | 12,139,824,710 |
31-Jul-23 | 2 | 1M | - 2,830,709,505 | 818,728,299 |
31-Jul-23 | 3 | 2M | 1,118,164,354 | - 1,118,254,637 |
31-Jul-23 | 4 | 4M | - 2,011,845,783 | 2,011,800,641 |
I followed the suggestion here: Solved: Re: Running Total / cumulative by Group - Microsoft Fabric Community
VAR _fg = CALCULATE(-1*SUM(RT[TotalCashflow]),
ALLEXCEPT(RT,RT[RefDtAsDate]),
RT[BucketDisplayOrder] >= EARLIER(RT[BucketDisplayOrder])
)
return _fg
However, I get error:
Earlier refers to row context that does not exist
what am i missing?
Solved! Go to Solution.
Hi, @alsm
try below
VAR _fg = CALCULATE(-1*SUM(RT[TotalCashflow]),
ALLEXCEPT(RT,RT[RefDtAsDate]),
RT[BucketDisplayOrder] >= max(RT[BucketDisplayOrder])
)
return _fg
and you can use abs(SUM(RT[TotalCashflow])) instead of -1*SUM(RT[TotalCashflow])
Hi @Dangar332
Thank you max works.
for my understanding
ALLEXCEPT would filter all the dates selected in slicer/filter
After the ALLEXCEPT filter, it would filter all buckets greater than bucket selected in slicer/filter (and if there is no bucket selected then max bucket is default)
PS: cannot use abs() cause it can be positive/negative and it should be invereted. Though in sample data it was happening to be total of -ve number
Hi, @alsm
try below
VAR _fg = CALCULATE(-1*SUM(RT[TotalCashflow]),
ALLEXCEPT(RT,RT[RefDtAsDate]),
RT[BucketDisplayOrder] >= max(RT[BucketDisplayOrder])
)
return _fg
and you can use abs(SUM(RT[TotalCashflow])) instead of -1*SUM(RT[TotalCashflow])
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
9 |