Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Date Expression- Set Analysis

Hi Community users,

I have a formula in QV

=avg({$<Date={'$(=max(Date))'}>} Sales)

Problem : QV does not calculate for the Data in which Sales records does not exists for max date for Customers having last sales date of previous month.

Is there any formula ,that will calculate avg for all the records for max date and auto calculate for those in which max date is of previous month.

e.g Customer has sales on 01-Mar-14

while b has Sales on 28-Feb-2014, i want it will calculate the avg for Customer A on 01-Mar-14 while for B it should be 28-Feb-14

Thanks.

12 Replies
nlmmaurya
Contributor II
Contributor II

Try this Avg(if(Date=aggr(max(Date),Customer),Sales)) may be it will work.

ashwanin
Specialist
Specialist

You can try :  avg({<Date={'>=$(=addmonth(max(Date)))'}>} Sales)

sanketkhunte
Creator II
Creator II

Hi Krishna,

If you are using Qlikview 11 then you may go through Alternate States. It becomes easy to present Previous and Current month of data by using this Comparative feature.

Sanket

Not applicable
Author

Hi Neelam,

Can we do this by Set Analysis?

Not applicable
Author

Hi Ashwani,

This is somewhat near, but here it calculates the data of two dates.

Not applicable
Author

Hi Sanket,

Yes, i am using QV-11. Can you please let me know, more about this?

I dont want to compare data. I want qv will calculate for all customers, where their sales dates is of last month.

Not applicable
Author

try this

avg({$<Date={'$(=aggr(max(Date),Customer)'}>} Sales)

Not applicable
Author

Hi Bertran,

Might be i have written something wrong.

Here Customer is in Dimension. I need an expression which took the last date.

i tried below, but this is also not working .

avg({$<Date={'$(=aggr(max(Date)'}>} Sales)

Not applicable
Author

if you want to get the last date by Customer you need :

aggr(max(Date),Customer)