Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Small Challenge!

Hello Experts!

I'm trying to present data in a straight table where I need to show Name, future data and previous total average count.

My data looks like this:

tab13.PNG

So if I do a count of ID per day and overall, I should get something like this:

tab15.PNG

Now, What I want to show is a straight table that should have the Name, future dates, these average values.

it should look something like this:

tab16.PNG

Is this something we can do in Qlik?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Why do you incrementally add your requirement brother ... PFA...

View solution in original post

21 Replies
sunny_talwar

Can you post a sample here? If not what is the expression used here?

Anonymous
Not applicable
Author

Sure! here is the data and the app.

Thanks

sunny_talwar

May be this:

If(Count(ID) > 0, Sum(TOTAL <Name> Aggr(Count(ID)/count(DISTINCT if(len(ID)>1, Date)),Name)))

sunny_talwar

Or this:

If(Count(ID) > 0, Count(TOTAL <Name>ID)/Count(TOTAL <Name> DISTINCT {<ID = {"=Len(ID) > 1"}>} Date))

Anonymous
Not applicable
Author

Basically I need this Straight table where it shows future dates only. In the data, I have 3 future days

01/04/2017

02/05/2017

07/05/2017

for A

and 2 future days for B

17/08/2017

21/09/2017

tab17.PNG

So this chart should only show Name A and B with all the future dates

Name Future Dates Last 3 Days Average

A 01/04/2017 5.6

A 02/05/2017 5.6

A 07/05/2017 5.6

B 17/08/2017 6.33

B 21/09/2017 6.33

And total in the end which is 29.67

sunny_talwar

May be this

Sum(Aggr(If(Count(ID) = 0, Count(TOTAL <Name>ID)/Count(TOTAL <Name> DISTINCT {<ID = {"=Len(ID) > 1"}>} Date)), Name, Date))

Capture.PNG

Anonymous
Not applicable
Author

Yep! This works but I now have some more data for another day for Name A.

NameDateSaleID
A17/01/2016600A201
A17/01/2016600A202
A17/01/2016600A203
A17/01/2016600A204
A17/01/2016600A205

I want this to be excluded in the calculations as I only want last 3 most recent days average.

sunny_talwar

Not sure I follow your question.... What is the expected output now? The same as before?

Anonymous
Not applicable
Author

Yep! The result should be the same as with the new data for Name A has now 4 distinct days and we need to calculate the average of only last 3 most recent days. The day which has been added for A is 17/01/2016 and it's the smallest date compared to these three dates already in the data:

10/06/2016

11/06/2016

12/06/2016

So it should not be included in the average calculation for A so the average should remain 5.66667