Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Timeframe Data Calculation

Hi all,

I am currently working with Actual and Forecast data for labor headcount, displayed by Month and Week.

My issue is: I use the SUM function to pull the data into my charts and tables, and it duplicates the Forecast correctly at the Weekly view for comparison to Actual. However, headcount is reported and forecast at a Monthly level, so I do not want it to sum all of the weeks value's when I drill up to Month. I only want it to show me the headcount from the final week in that month. Does anyone have any suggestions for how I can accomplish this?

Ex.

Dept                      Wk                         Mo                         Yr                            Cnt

129                         1                              1                              2014                       5

129                         2                              1                              2014                       5

129                         3                              1                              2014                       5

129                         4                              1                              2014                       6

So for the month the Cnt should be 6 for Dept 129 for Mo = 1 Yr = 2014 as that is the last week in the month.  But for the monthly display, it should show as above.

Thanks

8 Replies
phaneendra_kunc
Valued Contributor III

Re: Timeframe Data Calculation

See attached.

Not applicable

Re: Timeframe Data Calculation

Thanks, Phaneendra. My only problem is that financially, there might be either 4 or 5 weeks in a given Financial Month. So I am not able able to simply limit the set analysis to selecting Wk 4. Instead, I would like to have it select the Max Wk within the selected Month. Is there any way to do that?

Re: Timeframe Data Calculation

In the Month display use:

=FirstSortedValue(Cnt, -Wk)

-Rob

phaneendra_kunc
Valued Contributor III

Re: Timeframe Data Calculation

Rob's Expression will do for dynamic calculation.

Not applicable

Re: Timeframe Data Calculation

By "the Month display", where do you mean for me to place that expression? e.g. within the set analysis itself, within properties > dimensions, ...?

Re: Timeframe Data Calculation

I understood you wanted the last week value only when showing data at the Month level, not the weekly level. However, I think you can probably ignore my comment. Just use the expression I suggested as your Cnt Expression in the chart.   It should work for both levels of detail.

-Rob

phaneendra_kunc
Valued Contributor III

Re: Re: Timeframe Data Calculation

As Rob said just use =FirstSortedValue(Cnt, -Wk) as expression.

Refer to the example below.

This widget could not be displayed.