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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hello there,
I'm trying to create a Power Bi measure to replicate a SUMIF in Excel.
Using the example data below, what I'd like to do, for each row, is sum up Number if Date 1 is <= Date 2 minus variable.
e.g. on the first rown, 5th Jan minus 3 days is 2nd Jan, so "Aggregate -3" is 100.
Then on the 2nd and 3rd rows, 6th Jan minus 4 days is 3rd Jan, so "Aggregate -3" is 500. Aggresate - 4 takes us back to the 2nd Jan, so that columns would have -600.
Any idea how I can do this in a Power Bi method please?
Many thanks
| Variable | 3 | 4 | |||
| Region | Date 1 | Date 2 | Number | Aggregate (-3) | Aggregate (-4) |
| Europe | 2-Jan | 5-Jan | 100 | 100 | 100 |
| Europe | 3-Jan | 6-Jan | 200 | 500 | 600 |
| Europe | 3-Jan | 6-Jan | 300 | 500 | 600 |
| Europe | 4-Jan | 7-Jan | 400 | 3000 | 3700 |
| Asia | 4-Jan | 7-Jan | 500 | 3000 | 3700 |
| Asia | 4-Jan | 7-Jan | 600 | 3000 | 3700 |
| Asia | 4-Jan | 7-Jan | 700 | 3000 | 3700 |
| Asia | 4-Jan | 7-Jan | 800 | 3000 | 3700 |
Hi. I don't fully understand what is variable. But let's continue. I think you are looking something like this
VAR variable = ????
RETURN
SUMX ( FILTER ( Table , Table[Date1] <= Table[Date2] - variable ) , Table[Number] )
Hope this helps,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Happy to help!
I should have added, the Variable is driven by a slicer, so the value of the measure needs to change as the slicer changes.
Many thanks
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 6 | |
| 6 | |
| 5 |