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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.