Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Greetings everyone. I am new to DAX and need assistance. I have a table with a datetime column. I want to create a start time whenever the alarmStatus is on and and end time when its off. I then want to calculate the difference between these 2 new columns as shown below
Solved! Go to Solution.
1. Remove dateTime and alarmStatus from the visual.
2. Perhaps you need to update the measures:
Start Time = CALCULATE( MIN( Table1[dateTime] ), Table1[alarmStatus] = "ON")
End Time = CALCULATE( MAX( Table1[dateTime] ), Table1[alarmStatus] = "OFF")
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
1. Remove dateTime and alarmStatus from the visual.
2. Perhaps you need to update the measures:
Start Time = CALCULATE( MIN( Table1[dateTime] ), Table1[alarmStatus] = "ON")
End Time = CALCULATE( MAX( Table1[dateTime] ), Table1[alarmStatus] = "OFF")
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @Brighton10
1. Place the relevant fields in a table visual
2. Place these measures in the visual
Start Time = MIN( Table1[dateTime] )
End Time = MAX( Table1[dateTime] )
Duration (mins) = ( [End Time] - [Start Time] )* 24*60
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @AlB
I have implemented what you suggested but its not doing the calculation. I have filtered the country, region, sitename and its show zero (0) duration. So the function needs to check when filtered if the alarmStatus is on based on the previous time it was off then create a start time from there and do the same for when off. For example TerrainLightsOn was ON on 2021/01/24 which is supposed to be my start time then the next consecutive time its off is my end time. Thanks
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
10 | |
7 | |
6 | |
6 |
User | Count |
---|---|
30 | |
11 | |
11 | |
10 | |
6 |