Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi all,
I am trying to calculate the cumulative backlog based on the order ID. Orders are both planned and fulfilled, although fulfilment (production) of the order does not have to be on the same day.
Two fact tables basically exist in my model:
- Planning table with order ID, order qty, and deadline
- Production table with order ID, Qty produced and production date.
I want to calculate the total backlog of all the orders that were not fulfilled in time. Orders that are produced before the deadline are also fine and are not penalized or something. Backlog is calculated on a day basis
To illustrate:
Planning:
Production:
Which leads to the following, when one would build in Excel:
I have multiple (combinations) of proposed solutions from other questions, but have not managed to create the figure in PowerBI. I sincerely hope you guys can help! Looking forward to a respons.
Solved! Go to Solution.
You can create a measure like
Backlog =
VAR currentDate =
MAX ( 'Date'[Date] )
RETURN
SUMX (
'Planning',
IF (
SELECTEDVALUE ( 'Planning'[Deadline] ) > currentDate,
0,
VAR currentQty =
SELECTEDVALUE ( 'Planning'[Qty] )
VAR totalProduced =
CALCULATE (
SUMX ( RELATEDTABLE ( 'Production' ), 'Production'[Qty] ),
REMOVEFILTERS ( 'Date' ),
'Production'[Date] <= currentDate
)
RETURN
currentQty - totalProduced
)
)
Not sure why its not working at the aggregate level, but I was able to get a working aggregate with
Total Backlog = IF( ISINSCOPE( 'Planning'[Order ID]), [Backlog],
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Planning',Planning[Order ID]), "@val", [Backlog])
return SUMX( summaryTable, [@val]))
You can create a measure like
Backlog =
VAR currentDate =
MAX ( 'Date'[Date] )
RETURN
SUMX (
'Planning',
IF (
SELECTEDVALUE ( 'Planning'[Deadline] ) > currentDate,
0,
VAR currentQty =
SELECTEDVALUE ( 'Planning'[Qty] )
VAR totalProduced =
CALCULATE (
SUMX ( RELATEDTABLE ( 'Production' ), 'Production'[Qty] ),
REMOVEFILTERS ( 'Date' ),
'Production'[Date] <= currentDate
)
RETURN
currentQty - totalProduced
)
)
Hi John,
Thank you for the quick response.
I have three follow-up questions based on your proposals:
1. Does it assumes a third date table with relationsship as below? Or should it relate based on orderID
2. In which table should the measure be created?
3. The SUMX function you wrote has three arguments, which I am not able to recreate. How to deal with it?
Looking forward to your reply.
My solution assumes that there is no relationship from the Date table to either of the 2 tables, and a one-to-many relationship on orderID between planning and production.
It doesn't make any difference which table the measure is created on, it could go on either. Sometimes people like to have a separate table just for measures.
There should only be 2 arguments to the SUMX, I missed a closing ) after SELECTEDVALUE(Planning[Deadline])
Hi John,
Thanks. Could you insert the ) at the right position in your initial post? It still provides me with an error
Edited now. I'd missed out an entire CALCULATE as well.
Thanks. It provides me with the figure below. It does work, but does not gives the desired/expected result. Is there any way I can share the Pbix file, maybe it makes it easier (WeTransfer?).
Yes, you can share the file. Dropbox, Google Drive, OneDrive, whatever.
Not sure why its not working at the aggregate level, but I was able to get a working aggregate with
Total Backlog = IF( ISINSCOPE( 'Planning'[Order ID]), [Backlog],
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Planning',Planning[Order ID]), "@val", [Backlog])
return SUMX( summaryTable, [@val]))
This seems to be the solution. Thank you John! I could not have solved this
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.