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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
iamJL
Regular Visitor

dax problem: how to calculate total instock qty group by date and get final unshipped qty

 
raw date is from A~D

I want to get final unshipping quantity and Cumulative quantity (L & M column)

but I can't find perfect solution to solve this problem

 

K5 = C2+C3(=35000) - C5( first time instock group by order no )

K7 = K5-C7( second time instock group by order no )

K6 = K7-C6( third time instock group by order no )

K4= K6-(C4+C8) ( foruth time instock group by order no and it has 2 times  "instock" in one day )

 

L4 = total scheduled_qty - total instock_qty (35000-22281)

1.png

order_nodateQTYtype
A240400252024/5/1330878schedule_ship_date
A240400252024/12/314122schedule_ship_date
A240400252024/6/191922instock_date
A240400252024/5/34196instock_date
A240400252024/5/202335instock_date
A240400252024/5/1515instock_date
A240400252024/6/1913813instock_date
A240701092024/8/214000schedule_ship_date
A240600462024/7/121323schedule_ship_date
A240600462024/7/301instock_date
A240600462024/7/291instock_date
A240600462024/7/30212instock_date
A240600462024/7/191098instock_date
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @iamJL 

 

You can try the following methods.
Measure:

Final_unshipped_qty = 
Var _Sum1=CALCULATE(SUM('Table'[QTY]),FILTER(ALLEXCEPT('Table','Table'[order_no]),[type]="schedule_ship_date"))
Var _Sum2=CALCULATE(SUM('Table'[QTY]),FILTER(ALLEXCEPT('Table','Table'[order_no]),[type]="instock_date"))
RETURN
_Sum1-_Sum2

vzhangtinmsft_0-1723710205648.png

The rest of the calculations require you to elaborate on the logic.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi, @iamJL 

 

You can try the following methods.
Measure:

Final_unshipped_qty = 
Var _Sum1=CALCULATE(SUM('Table'[QTY]),FILTER(ALLEXCEPT('Table','Table'[order_no]),[type]="schedule_ship_date"))
Var _Sum2=CALCULATE(SUM('Table'[QTY]),FILTER(ALLEXCEPT('Table','Table'[order_no]),[type]="instock_date"))
RETURN
_Sum1-_Sum2

vzhangtinmsft_0-1723710205648.png

The rest of the calculations require you to elaborate on the logic.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

lbendlin
Super User
Super User

Could it be as easy as putting the data into a matrix visual?

 

lbendlin_0-1723648363342.png

 

I tried.. if i turn raw data into  a matrix visual

and if i have a order no span different month, i get error value like picture (A24070041)

(please ignore the name of  order no 'TA' or 'A')

I should get  final unshippind qty '0' .... but it will show 870  , it should be instocked all quantity in July so it can't be count as unshipped.

3.png2.png

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors