Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Periods of calculation

Hello,

For productions statistics, I would like a table showing stat for a specifc week and the same table with the same stats but for a period going from a specific fixed date to the week selected previously.

For the first table, it's not hard to change form week to week, but for the second one, I'm not able to secify a period of calculation into the parameters of the table.


Let say for example that the stats for Machine A have to be calculated from September 1, how could I write this condition and where?

Thanks a lot!
Vincent

10 Replies
Not applicable
Author

You could create a mapping spreadsheet in excel to map periods to dates, for example:

01/04/2014 Period 1

02/04/2014 Period 1

....

30/04/2014 Period 2

Kasia

timsworldroamer
Partner - Contributor III
Partner - Contributor III

You probably can accomplish that with set analysis:

=Sum({<Date=">$(=vPrevDate)">*<Date="<=$(=vCurrDate)">}Stats)

where vPrevDate and vCurrDate is the period for which you want your Stats to aggregate.

Hope this helps.

Tim

Not applicable
Author

I thought about this solution, but I would have to write this in each expression, is it possible to apply this to the whole table instead?

Not applicable
Author

I'm not sure why, but the expression is not working, it's underlined with red, so there is a mistake but I can't find it 😕

timsworldroamer
Partner - Contributor III
Partner - Contributor III

Could you post your expression here for us to read and check?

Note: vPrevDate is a variable and $(=vPrevDate) means to use the current value for vPrevDate. If vPrevDate is a field, no $(=) is needed.

Not applicable
Author

Since the expression is using a sum, I removed it because I don't need to use a sum on the whole table, therefore the expressions is not working 😕

timsworldroamer
Partner - Contributor III
Partner - Contributor III

Set analysis works only with the aggregating functions. What are you trying to do exactly? Would you be able to give us a masked sample of your data?

Not applicable
Author

I was able to define the start date so this is not a problem anymore. The issue is the final date. It has to be the week selected. Therefore I stored it in a variable so it is easier to use in a expression:

sum({1 <JC_OPE_DATE="<$(=vSemaineSelect)">}OPRE_DUREE)/60

but it doesn't work 😕

timsworldroamer
Partner - Contributor III
Partner - Contributor III

The syntax looks correct to me. I suspect the date/week is not properly stored in vSemaineSelect.