The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello all,
I am trying to figure out how to merge product ID based on time ranges from another tables.
I have 4 tables. One table consists of Product IDs and timestamps when the specific product was produced. So for example product ID 173 was produced from 25. 4. 2022 8:08:04 until 25.4.200 11:29:30 when the Product ID 336 started.
In the other tables I have some metrics measurements, their values and timestamps which are updating every 5 secs. So all of these timestamps should have Product ID 173 based on the table above.
What I want to solve is how to recognize the product ID based on the time ranges in the measurements tables. Is it somehow possible to realize?
Thank you so much for your help.
Solved! Go to Solution.
Hi @richard961116 ,
You could add two calculated columns to get the start and end time for a [Product ID] on Model number table:
start_ =
CALCULATE (
MIN ( 'model number'[time] ),
FILTER (
'model number',
'model number'[product ID] = EARLIER ( 'model number'[product ID] )
)
)
end_ =
CALCULATE (
MAX ( 'model number'[time] ),
FILTER (
'model number',
'model number'[product ID] = EARLIER ( 'model number'[product ID] )
)
)
Then add [product ID] to the Product height table:
Product_ID =
CALCULATE (
MAX ( 'model number'[Product ID] ),
FILTER (
'model number',
'Product height'[time] >= 'model number'[start_]
&& 'Product height'[time] <= 'model number'[end_]
)
)
Best Regards,
Jay
Hi @richard961116 ,
You could add two calculated columns to get the start and end time for a [Product ID] on Model number table:
start_ =
CALCULATE (
MIN ( 'model number'[time] ),
FILTER (
'model number',
'model number'[product ID] = EARLIER ( 'model number'[product ID] )
)
)
end_ =
CALCULATE (
MAX ( 'model number'[time] ),
FILTER (
'model number',
'model number'[product ID] = EARLIER ( 'model number'[product ID] )
)
)
Then add [product ID] to the Product height table:
Product_ID =
CALCULATE (
MAX ( 'model number'[Product ID] ),
FILTER (
'model number',
'Product height'[time] >= 'model number'[start_]
&& 'Product height'[time] <= 'model number'[end_]
)
)
Best Regards,
Jay
@richard961116 , In DAx Column in Table 1
End Time = MinX(filter(Table, [product id] = earlier([product id]) && [Time] > earlier([Time]) ),[Time])
Product Height = maxx(filter(Table2, Table[product id] = (Table2[product id]) && [End Time] > (Table2[Time]) && Table[Time] <= (Table2[Time]) ),Table2[Product Height])
@amitchandak thank you for your response. For the first column it works.
But for the another one, it can't find product id in the 'Product height' table because there are no relations between them and I'm not sure how to solve it.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
122 | |
89 | |
75 | |
55 | |
45 |
User | Count |
---|---|
134 | |
120 | |
76 | |
65 | |
64 |