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,
I have a data with columns "total Machine running hours', 'Machine ON/OFF status', 'Date' & 'Time'.
data is refreshed at every 30 mins interval, i want to calculate total running time of previous day or live.
Can anyone help.
Regards
Satish
Solved! Go to Solution.
Hi @skumar0105
You can add a calculated column with below DAX.
Running Hours =
VAR MaxHours = CALCULATE(MAX('Table'[CHILLER_U9_COMP_RUNNING_TIME]),ALLEXCEPT('Table','Table'[Date]))
VAR MinHours = CALCULATE(MIN('Table'[CHILLER_U9_COMP_RUNNING_TIME]),ALLEXCEPT('Table','Table'[Date]))
VAR MaxTime = CALCULATE(MAX('Table'[Time]),ALLEXCEPT('Table','Table'[Date]))
RETURN
IF('Table'[Time] = MaxTime, MaxHours - MinHours, BLANK())
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi Everyone,
I am still struck at this issue, prompt response will be appreciable.
Regards
Satish
@skumar0105 Seems like a variation of MTBF. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous
@skumar0105 Right, so it depends on what you are trying to do exactly and what the data is. If the "CHILLER" column is your running total time and I'm guessing it is in minutes or hours or ? Anyway. If you want the current day's total running time then I am guessing that you could take the MAX "CHILLER" for TODAY. Also get the MIN "CHILLER" for TODAY. Subtract the two.
For previous day, TODAY() - 1.
@Greg_Deckler can you write syntax to find out daily running time, i am new to this field.
BTW the Chiller running time is in hours.
Simply, i want the output as below table:
ON_OFF_STATUS | CHILLER_U9_COMP_ RUNNING_TIME | Time | Date | Duration of the Chiller Run Today (hrs) |
ON | 52647.500 | 10:00:00 | 07.07.2022 | 1 |
OFF | 52647.500 | 09:00:00 | 07.07.2022 | |
ON | 52646.500 | 08:00:00 | 07.07.2022 | |
OFF | 52646.500 | 23:55:00 | 06.07.2022 | 1.50 |
ON | 51646.000 | 23:05:00 | 06.07.2022 | |
OFF | 51646.000 | 23:00:00 | 06.07.2022 | |
ON | 51645.000 | 22:00:00 | 06.07.2022 |
Please ignore formatting.
Regards
Satish
Hi @skumar0105
You can add a calculated column with below DAX.
Running Hours =
VAR MaxHours = CALCULATE(MAX('Table'[CHILLER_U9_COMP_RUNNING_TIME]),ALLEXCEPT('Table','Table'[Date]))
VAR MinHours = CALCULATE(MIN('Table'[CHILLER_U9_COMP_RUNNING_TIME]),ALLEXCEPT('Table','Table'[Date]))
VAR MaxTime = CALCULATE(MAX('Table'[Time]),ALLEXCEPT('Table','Table'[Date]))
RETURN
IF('Table'[Time] = MaxTime, MaxHours - MinHours, BLANK())
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
You will need to post some sample/dummy data. Refer to this - How to provide sample data in the Power BI Forum - https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
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.