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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
b2wise
Helper III
Helper III

Is this possible in DAX? Do I need to Modify my table?

Hi all,

 

I have a table that shows when an item arrives in the warehouse and when it's put away, the arrivals (IND), and put-aways (PUT), are shown on seperate lines. Each item can have multiple lines for arrival and putaway.

 

I need to find the average amount of time between an item's first arrival and first putaway, this number would be shown in a card visual.

 

Is this possible with this type of table or do I need to do more data modeling?

 

Sample tabe below. To track a unique item use order_no concatenated with line_no, Record_Type shows if its IND (arrival) or PUT (putaway). A bonus would be to see avg. time if backorder_active = "Y". Thank you!!!

 

RECORD_TYPEORDER_NOLINE_NODATE_CREATEDTIME_CREATEDvWT_PORECEIPT_PIDS.BACKORDER_ACTIVE
IND542372491Monday, January 11, 202112:17:56 PMN
IND542372491Monday, January 11, 202112:17:56 PMN
IND542372491Monday, January 11, 202112:17:56 PMN
IND542369291Monday, January 11, 202111:48:12 AMN
IND542369291Monday, January 11, 202111:48:12 AMN
IND542372522Monday, January 11, 202112:20:23 PMY
IND542372492Monday, January 11, 202112:12:18 PMN
IND542372521Monday, January 11, 202112:17:18 PMN
IND542359821Monday, January 11, 202111:37:09 AMY
PUT542372522Tuesday, January 12, 20218:02:58 AMY
PUT542372492Tuesday, January 12, 20218:02:26 AMN
PUT542372491Tuesday, January 12, 20218:06:11 AMN
PUT542372491Tuesday, January 12, 20218:08:17 AMN
PUT542372491Tuesday, January 12, 20218:08:17 AMN
PUT542369291Tuesday, January 12, 20217:57:01 AMN
PUT542369291Tuesday, January 12, 20217:57:02 AMN
PUT542372521Tuesday, January 12, 20218:08:16 AMN
PUT542359821Wednesday, January 13, 20212:11:37 AMY
3 REPLIES 3
Jihwan_Kim
Super User
Super User

Picture1.png

 

AVG hours =
var _newtable=
ADDCOLUMNS (
SUMMARIZE ( Data, Order_No[ORDER_NO], Line_No[LINE_NO] ),
"@first_arrival",
CALCULATE (
VAR currentrecord = "IND"
VAR currentorder =
MAX ( Order_No[ORDER_NO] )
VAR currentline =
MAX ( Line_No[LINE_NO] )
RETURN
CALCULATE (
MIN ( Data[Date & Time] ),
Record_Type[RECORD_TYPE] = currentrecord,
Order_No[ORDER_NO] = currentorder,
Line_No[LINE_NO] = currentline
)
),
"@first_putaway",
CALCULATE (
VAR currentrecord = "PUT"
VAR currentorder =
MAX ( Order_No[ORDER_NO] )
VAR currentline =
MAX ( Line_No[LINE_NO] )
RETURN
CALCULATE (
MIN ( Data[Date & Time] ),
Record_Type[RECORD_TYPE] = currentrecord,
Order_No[ORDER_NO] = currentorder,
Line_No[LINE_NO] = currentline
)
)
)
return
AVERAGEX(_newtable, DATEDIFF([@first_arrival], [@first_putaway],HOUR))
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you @Jihwan_Kim! Can you explain why you made the three additional tables? I was able to recreate your measure using only the Data table.

 

Also would putting a visual level filter for "Backorder Active" "Y "or "N" return the correct results?

Hi @b2wise 

the reason I think why Jihwan_Kim made the 3 additional tables is he didn't have your sample, then he create them as dimension tables.  Although not necessary, dimension table does contribute to model management. 

 

 

Best Regards,

Community Support Team _Tang

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors