6 Replies Latest reply: May 30, 2016 3:07 PM by Michele Van Laningham

# Creating a measure based on set time periods.

I am trying to create a measure for 3 gauge chart showing me % on time deliveries. A gauge chart for each time period of 1,4,13 weeks).

Here is my calc:

count of items classified as On Time/count of total population during reporting period)*100

My thought process was the following:   (which is giving me an error). !

sum(Count([Rct_Date]-[Del_Date]<=0)) / (sum(total(Count(Rct_date))))

Then qualify by the time period I need and use each measure based on it's time period in the appropriate gauge chart.

Any help would be greatly appreciated!

• ###### Re: Creating a measure based on set time periods.

Try

Count(If( [Rct_Date]-[Del_Date]<=0,1)) /  Count( Total  Rct_Date])

Does this work?

• ###### Re: Creating a measure based on set time periods.

Thank you!  That does help with the first part of my question.  Now I just need to find out how limit to the correct time periods!

• ###### Re: Creating a measure based on set time periods.

And how  do you calculate these time periods or in what fields are these time periods based upon?

• ###### Re: Creating a measure based on set time periods.

So, here's my next thought (for gauge #1 - 13 weeks)...I'm versed in sql, so my thoughts go to dateadd.  I could be totally off here as to a formula in Qlik....:

If(Rct_date>=(today()-13Week),

Count(If( [Rct_Date]-[ERF_END_Date]<=0,1)) /  Count( Total  Rct_Date])*100

,1)

I know the expression is not quite right, as I have an error, but can anyone direct me?

Again, what I am trying to accomplish is?

• create a measure for 3 gauge chart showing me % on time deliveries.
• A gauge chart for each time period of 1,4,13 weeks).

Here is my needed calc:

count of items classified as On Time/count of total population during reporting period)*100

• ###### Re: Creating a measure based on set time periods.

In general, use aggregation functions in expressions:

Use Aggregation Functions!

Try

Count(If( [Rct_Date]-[ERF_END_Date]<=0 and [Rct_Date]>=Today()-13*7 ,1)) /  Count( Total  If([Rct_Date]>=Today()-13*7,Rct_Date]))*100

• ###### Re: Creating a measure based on set time periods.

Thanks for the direction!!