Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Partner
Partner

See attached.

Not applicable
Author

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?

rwunderlich
MVP & Luminary
MVP & Luminary

In the Month display use:

=FirstSortedValue(Cnt, -Wk)

-Rob

phaneendra_kunc
Partner
Partner

Rob's Expression will do for dynamic calculation.

Not applicable
Author

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

rwunderlich
MVP & Luminary
MVP & Luminary

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
Partner
Partner

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

Refer to the example below.

Not applicable
Author

So if we actually need it to be a little different because we have an employee ID in this example that really has a count of 1 but then is summed to get the week total, how would you do that calc.  See attachment below.

So instead of seeing the 8 and 6 in the last column I really want to see 1 and 4 as those are the counts for the last week of each month?

Thanks!