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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
v-zhangtin-msft
Community Support
Community Support

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
v-zhangtin-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.