Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Voyageur83
New Member

OPEN ORDERS

Hi,

Suppose the sample datas attached. Using this data we would like a measure that tracks open orders
so that at each date point on a line chart we are looking at Available qty orders open 30 days prior to the required date.

Thanks

 

DATE_REQUIREDQTY_ORDEREDQTY_DELIVEREDDATE_ORDERPRODUCTDATE_DELIVERED
2-Jan-242702838-Dec-23P9800018-Dec-23
3-Jan-24103-Jan-24P25717 
3-Jan-24146161461611-Dec-23P337923-Jan-24
3-Jan-243408340811-Dec-23P337933-Jan-24
3-Jan-24132430-Aug-23P999474-Jan-24
3-Jan-24800101030-Aug-23P1000174-Jan-24
3-Jan-2411798117988-Dec-23P1035313-Jan-24
3-Jan-2411484114848-Dec-23P1041073-Jan-24
3-Jan-241741688-Dec-23P1045303-Jan-24
3-Jan-242128214322-Dec-23P1081835-Jan-24
3-Jan-242128212822-Dec-23P1081845-Jan-24
3-Jan-248464897222-Dec-23P10818515-Jan-24
3-Jan-2441441418-Dec-23P1089455-Jan-24
3-Jan-244418-Dec-23P1089465-Jan-24
3-Jan-2414615222-Dec-23P10990824-Jan-24
3-Jan-2495295222-Dec-23P11004615-Jan-24
3-Jan-241476147622-Dec-23P11017610-Jan-24
3-Jan-2436011-Dec-23P110953 
3-Jan-24603-Jan-24P111160 
3-Jan-2484011-Dec-23P111161 
3-Jan-2432407-Dec-23P112926 
3-Jan-2432407-Dec-23P113227 
3-Jan-2454008-Jan-24P113811 
3-Jan-24216006-Dec-23P116871 
3-Jan-24276030-Nov-23P117578 
3-Jan-24276030-Nov-23P117873 
3-Jan-24276030-Nov-23P118161 
3-Jan-24360108-Jan-24P118339 
1 ACCEPTED SOLUTION
Voyageur83
New Member

Thank you for the help.

I use a pattern from SQLBI Computing open orders,  and update it from my need.

View solution in original post

4 REPLIES 4
Voyageur83
New Member

Thank you for the help.

I use a pattern from SQLBI Computing open orders,  and update it from my need.

Kedar_Pande
Super User
Super User

@voyageur

Create a measure:

Open Orders (30 Days Prior) =
VAR SelectedDate = MAX('DateTable'[Date])
VAR StartDate = SelectedDate - 30
RETURN
SUMX(
FILTER(
Orders, -- Replace 'Orders' with the name of your table
Orders[DATE_REQUIRED] >= StartDate &&
Orders[DATE_REQUIRED] <= SelectedDate
),
Orders[QTY_ORDERED] - Orders[QTY_DELIVERED]
)

Add DateTable[Date] to the X-axis of your line chart.
Use the Open Orders (30 Days Prior) measure as the Y-axis.

 

💌 If this helped, a Kudos 👍 or Solution mark ✔️ would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

FreemanZ
Super User
Super User

hi @Voyageur83 ,

 

try like:

measure =
VAR _date = MAX(data[date_required])
VAR _result =
SUMX( FILTER(
data,
data[ date_required]>= _date- 30
&&data[ date_required] <= _date
),
QTY_ORDERED - QTY_DELIVERED
)
RETURN _result

Sahir_Maharaj
Super User
Super User

Hello @Voyageur83,

 

Can you please try this approach:

Open Orders 30 Days Prior = 
VAR CurrentDate = MAX('Orders'[DATE_REQUIRED])
VAR PriorDate = DATEADD(CurrentDate, -30, DAY)
RETURN
    CALCULATE(
        SUMX(
            FILTER(
                'Orders',
                'Orders'[DATE_REQUIRED] <= CurrentDate &&
                'Orders'[DATE_REQUIRED] > PriorDate &&
                'Orders'[QTY_ORDERED] > 'Orders'[QTY_DELIVERED]
            ),
            'Orders'[QTY_ORDERED] - 'Orders'[QTY_DELIVERED]
        )
    )

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.