Greetings,
I have this measure, inspired from Gerhard Brueckl, to track events in-progress between two dates:
this measures works as intended, however, my requirement is to track events in-progress between a start time and end time. So I just modified the measure to point to the appropriate tables/columns:
however, this does not work because the modified measure uses a Time Table in the DATESBETWEEN function:
These are the columns used in the original measure connected to my Date Table:
And these are the columns used in the modified measure connected to my Time Table:
You’ll need to replace the DATESBETWEEN function with another functions returning a single column table with ‘Time Table’[Time] values. For example a FILTER over VALUES(‘Time Table’[Time] ).
Excellent! But this requires a filter expression, where as the original measure did not filter a table here…
Is this where I should be using MAX(‘Time Table’[Time]) and MIN(‘Time Table’[Time]) variables, like this?
Edit: As it turns out this is very inefficient, seems like I may need to tweak something here:
However, this modified measure does produce some interesting results even though it’s not completely accurate:
This is a Matrix with hours on the rows (0-23) and machine names on the columns, basically counting the hours the machines are busy.
What is the most interesting is that when machines are busy for longer than 24 hours, the measure populates the previous hours:
This machine starts at 8pm on the 17th and ends at 7am on the 20th, and the measure counts backwards from 8pm to 7am as you see here. Obviously this is not the intended results, but I’m much closer to solving this challenge now.
Hi @Melissa, so I have good news and great news…
Using the VALUES(‘Time Table’[Time]) function with this filter gave me the correct results for about 95% of the cases, which is the great news!!
And good news is I’ve identified the logic for the remaining 5% of cases where the measure is not producing results. I just need help adjusting the query to cover those cases.
So, whenever the end date is in the future and the end time is before the start time, the measure does not produce a result. For example,
Start Date = July 7
Start Time = 10AM
End Date = July 8
End Time = 9AM
This case will not be counted. However, if for example the end time is 11AM, then the case would be counted.
Still trying to get this to work,
So far I’ve got this measure that’s almost 100% functional, but it is realllllllly sloooooow…
Does anyone have suggestions on how to optimize this?
Glad to read this query is solved, please mark it as such.
For optimization you will have to provide a sample PBIX file, that is required. When you can provide that, create a new topic in the category below:
Hi @Schreg, did the response provided Melissa help in solving your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark as solution the answer that solved your query.