March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Hi All,
I got an issue and even going through most of Time Blogs can't get my brain ticking...
I got this data where dateTime is one field and SKU is other. I want to find how long a SKU takes to change on a given date (time). Some days SKU will be running for 5 days but what I am interested is when it change from one SKU to other whats the time difference .
Thanks
Hi @Anonymous ,
As a general advise, please, provide data sample in a table format (not as an image) and an example of the expected result. How to Get Your Question Answered Quickly
If you expect to have this result
you can try the measure below:
diff_h =
VAR c_sku = SELECTEDVALUE ( T[SKU] )
VAR minDate =
MINX (
FILTER ( ALL ( T[DateTime_], T[SKU] ), T[SKU] = c_sku ),
T[DateTime_]
)
VAR c_date = SELECTEDVALUE ( T[DateTime_] )
VAR prevDate =
CALCULATE (
MAX ( T[DateTime_] ),
FILTER ( ALLSELECTED ( T ), T[DateTime_] < c_date )
)
VAR difference = DATEDIFF ( prevDate, c_date, HOUR )
RETURN
IF ( c_date = minDate && NOT ( ISBLANK ( prevDate ) ), difference, BLANK () )
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
@Anonymous Hi sahwal,
Let's say your table is as below,
DateTime_ | PO | Line_id | SKU |
2021-01-01 | 1234 | 1 | 170448 |
2021-01-02 | 1234 | 1 | 170448 |
2021-01-03 | 1234 | 1 | 170448 |
2021-01-04 | 1234 | 1 | 170448 |
2021-01-05 | 1234 | 1 | 180111 |
2021-01-06 | 1234 | 1 | 180111 |
2021-01-07 | 1234 | 1 | 180111 |
2021-01-08 | 1234 | 1 | 200100 |
2021-01-09 | 1234 | 1 | 300100 |
To get the time period for each SKU you can try below measure;
I hope this helps you.
If you like my answer please select this as the solution and Kudo.
Thanks!
HI Colacan
Looks good but what its doing is giving me total hours a SKU run in a day or year what I was looking for eg
SKU datetime
109328 30/08/2021 3:17 am
112111 30/08/2021 6:15am
156674 02/09/2021 1:00Pm
Now when in Maufacturing we did chnage from lets say 109328 to 112111 it should tell me time it took to do changeover (6:15-3:17 )am=x hours
Hi @Anonymous ,
Can you please share a sample dataset to check this further ?
Regards,
Jaideep
I did in the problem. do you need the excel file ?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
29 | |
12 | |
11 |