Platform

Β View Only

 Calculate elapsed time as a % of an hour

Jump to  Best Answer
  • TBMStudio
Stephanie Geltrude's profile image
Stephanie Geltrude posted Fri April 23, 2021 03:33 PM
I have an interesting challenge that may not be unique, so bringing it to this group for ideas.

We have a dataset that includes DATE and TIME as separate fields. On import, the DATE field is set to a date type m/dd/yyyy. Easy enough.
The TIME field is of the format: "00.00.00.000000". In a formula, I've substituted "." for ":". 


Challenge #1: Using these available DATE and TIME fields, I want to calculate which hour of the day 0-23 the INTERVAL LENGTH applies to. I hope that makes sense. In other words, I want to somehow calculate that of the INTERVAL_LENGTH of 60.295, 2 minutes and 36 seconds occurred within hour #8 on April 2nd and the remaining 57 minutes and 42 seconds occurred within the 9th hour of April 2nd.

 My thought is that if I could convert the DATE and TIME fields to a time stamp, I could then convert the TIMESTAMP and INTERVAL LENGTH fields to a common value like seconds and be able to do some time math...

Challenge #2: I can't seem to find a formula that will concatenate my DATE and TIME fields as a true time stamp. I've tested various approaches by calculating the interval using an Eval() formula and so far all of my attempts come up to 0.

​Now, I may not even need to do any of this, I may have total and complete analysis paralysis at this juncture. I think this is probably achievable without a TIMESTAMP field if I use a reference table, but this is MF data so I want to do the absolute least amount of XREF I can before grouping my dataset by CEC, JOB, START DATE, END DATE, and HOUR. 

Has anyone done some thing similar to this before? Tried to evaluate which side of an hour a duration of time falls within? 

Thanks!!!
​​
#TBMStudio
Apptio Community Member's profile image
Apptio Community Member  Best Answer

Hi Stephanie,
This is an interesting task.  I worked it out in Apptio and created a video with a solution that I believe solves for what you're looking for.  The video walks through the formulas and steps I used, and attached is an image of the end result.  Let me know if this is what you were looking for.  
https://youtu.be/23guyPlO_7k

Josh


#TBMStudio
Attachment  View in library
Capture.PNG 50 KB
Guillermo Cuadrado's profile image
Guillermo Cuadrado
Interesting issue. In Excel it works well (I think). I am trying to convert a number into a date, but can't seem to get it done :-(
I'll keep trying, @Stephanie Geltrude.​
#TBMStudio
Guillermo Cuadrado's profile image
Guillermo Cuadrado
Curious to see what @Stephanie Geltrude's is to the video (excellent, BTW). I had understood the problem in a different way, but @Joshua Roberto's answer seems to be more appropriate (and elegant) than what I was trying to do.​​​
#TBMStudio
Stephanie Geltrude's profile image
Stephanie Geltrude
@Joshua Roberto this is AMAZING!! I was thoroughly STUMPED and you make it look so easy 😎

Thank you for taking the time to help me out with a very thorough suggestion, super appreciate the video! I went ahead and configured to your suggestion and this is exactly what I was trying to achieve.

The use case is to replicate MaaS billing which relates to the 4HRA of consumption. I took your steps to arrive at minutes by hours 0-23. Then added a MIPS PER MINUTE field = (MIPS/INTERVAL LENGTH)*MINUTES to arrive at a directionally correct evaluation of MIPS consumption relative to the running time within each hour.​ I say directionally correct because running time isn't = to running load but it's the only metric we have to leverage.

Then I grouped by ARTIFACT, DATE, and WHICH HOUR? to arrive at: XREF to pull in the PROUDCT and SYSID after grouping the 1MM rows into 30K


My MF folks want to see MIPS consumption by hours 00-23 of each day to identify the 4HRA and which ARTIFACTs are generating that peak. The 2nd bit is then to flush the Maas cost through the applications that own those artifacts since the billing is relative to only the peak and not the full population of MIPS.
#TBMStudio
Apptio Community Member's profile image
Apptio Community Member

I’m happy this was helpful!

Delivering such a complicated Use Case to the MF team should be a great win for your TBMO.

If you have any more fun brain teasers, ping me anytime.

…And follow our BoostTBM YouTube channel.  We try to post a new video weekly, or however long it takes to think of something worth recording 😊


#TBMStudio