2 Replies Latest reply: Nov 13, 2016 6:57 PM by Lech Miszkiewicz

# Duration of a full Month in Minutes

Hi All,

I want to show the duration of a minutes of current Months. Lets say today is 12th Nov 2016. So I want to calculate 30*24*60 = 43200.

I am able to do this. using this function:

Script Level:

Date(MonthStart(date#([sys_created_on],'YYYY-MM-DD hh:mm:ss')), 'YYYY-MMM')  as [Outage_Sys_Month_Year],

Date(MonthStart(date#([sys_created_on],'YYYY-MM-DD hh:mm:ss')), 'YYYY-MM-DD hh:mm:ss')  as [Outage_Sys_MonthStartDate],

Date(MonthEnd(date#([sys_created_on],'YYYY-MM-DD hh:mm:ss')), 'YYYY-MM-DD hh:mm:ss')  as [Outage_Sys_MonthEndDate],

KPI Level:

(Outage_Sys_MonthEndDate - Outage_Sys_MonthStartDate)*24*60

But I want to make this fixed for current Month. It should not change with Outage_Sys_Month_Year selection.

I tried to implement using variable. But not sure how to apply that.

Thanks,

Sarif

• ###### Re: Duration of a full Month in Minutes

Assuming KPI level means in UI

Try this..

=(max({<Outage_Sys_Month_Year=>}Outage_Sys_MonthEndDate) - max({<Outage_Sys_Month_Year>}Outage_Sys_MonthStartDate))*24*60

• ###### Re: Duration of a full Month in Minutes

As your expression meant to show always no of minutes from Month Start till now why  not to use this expressions:

=(Now()-MonthStart(Now()))*24*60

or if you like to format it nicely i would use interval function like this:

=Interval(Now()-MonthStart(Now()),'ddd hh:mm:ss') which will result in somtehing like this: 013 10:55:53

=Interval(Now()-MonthStart(Now()),'mmmmm:ss') which will result in somtehing like this: 19376:53

Those expressions can be implemented in script, variable calculation or expression field.

Let me know if it helps

regards

Lech