Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

mhmmd_srf
Contributor

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.

Please help.

Thanks,

Sarif

2 Replies
phaneendra_kunc
Valued Contributor III

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




Lech_Miszkiewicz
Honored Contributor III

Re: Duration of a full Month in Minutes

Hi Mohammad

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

cheers Lech
When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution.
Please LIKE threads if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem.
Community Browser