Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare two periods.

Hi,

I have a little problem concerning a calculation with periods of dates

I does a selection into a period between 14/11/09 and 15/05/10.

My statistic is good for the calculation into the period (sum(Amount)=>Ok

I would like to compare this calculation with the same period the past year(14/11/08 --> 15/05/09)

I am a beginner into Qlikview and it's impossible to find the formula that will compare with the previous period.

Can you help me?

Thanks a lot

Mk

1 Solution

Accepted Solutions
Not applicable
Author

It could be something like this:


sum({1 <Date={"$(='>=' & AddMonths(min({$} Date), -12) & '<=' & AddMonths(max({$}Date), -12))"}>} Amount)


See the example in attachment

View solution in original post

12 Replies
Not applicable
Author

It could be something like this:


sum({1 <Date={"$(='>=' & AddMonths(min({$} Date), -12) & '<=' & AddMonths(max({$}Date), -12))"}>} Amount)


See the example in attachment

Not applicable
Author

That's great !

All is ok !

Thanks a lot for your help

Ciao

Mk

Not applicable
Author

Hi Nick and all,

I have a little problem with this expression because, since I put this calculation, the filters selected (Products,...) are not executed.

The filters are only applied into the columns without his calculation.

Can you help me?

Ciao

Michael

suniljain
Master
Master

Dear Martelmi,

please post your qlikview application.

Regards

Sunil Jain.

Not applicable
Author

Hi

Here is an extract of the file.

Thanks a lot for you help

Ciao

Not applicable
Author

Try this:

=sum({<DATELIV={"$(='>=' & AddMonths(min({$} DATELIV), -12) & '<=' & AddMonths(max({$}DATELIV), -12))"}>} CAFACTURE)


Not applicable
Author

Hi,

If I keep my period, the amount is null.

The '1' is essential, in my opinion( What's this number? :-))

The problem is often when the statistic does more 1 column(In the example that I sent, the problem is resolved (also more columns)but in my real file, it's not correct)and when the table is dynamic .

If you want, i can send you another file with more details but I have to work in this file(delete curtain data 🙂 ).

Thanks a lot

Not applicable
Author

If you are getting null it means there is no any data for previous period - check your data and conditions.

About 1 in Set Analysis:

There is one constant that can be used to denote a record set; 1. It represents the full set of all the records in the application.

The $ sign represents the records of the current selection. The set expression {$} is thus the equivalent of not stating a set expression. {1-$} is all the more interesting as it defines the inverse of the current selection, i.e. everything that the current selection excludes.

Read more in the Help for Set Analysis.



About your Applications I can say that there are individual approaches for each individual application. Usually Cut&Past doesn't work. Think first.

To help you with your applications it always better to have a sample which duplicates a critical piece of the application or the application itself.

Not applicable
Author

Hi

I check my data and I have data in the previous period.I join you the file with a particular case.

If I select one product, data , without the formula, are refreshed correctly.

But the problem is that the data, in the previous period, are refreshed for all products.

Is it possible to look this if you have any idea?

I searching in the help , in forums...

Can you help me?

Ciao