Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
alvarogh27
Contributor II
Contributor II

Sales Last hour. RangeSum and Peek Questions

Hi,

I need to calculate the Sum of Sales and the number of clients in the last hour of each checker.

For example:

I have this table:

 

CheckerClientHourSales
116:35:5610
126:39:1821
136:42:3515
146:47:3727
156:51:4130
166:57:0448
177:00:1633
187:03:5931
197:08:0044
1107:10:4928
1117:14:3368
1127:17:4660
1137:21:4169
1147:23:5352
1157:26:2852
1167:28:3245
1177:30:4033
1187:32:5453
1197:34:5634
1207:37:3130
1217:39:4648
1227:42:5254
1237:45:2551
1247:48:32

55

and I need to get:

   

CheckerClientHourSalesSum sales Last hourCount Client Last hour
116:35:5610
126:39:1821
136:42:3515
146:47:3727
156:51:4130
166:57:0448
177:00:1633
187:03:5931
197:08:0044
1107:10:4928
1117:14:3368
1127:17:4660
1137:21:4169
1147:23:5352
1157:26:2852
1167:28:3245
1177:30:4033
1187:32:5453
1197:34:563475319
1207:37:313077319
1217:39:464880019
1227:42:525483919
1237:45:255189020
1247:48:325591820

I've tried to combinate Range Sum with Peek Function, but I don't know how to build a condition variable according to Hour Field and the last hour. For example, the range to get Sumsales for the last register (Client 24) is SumSales from client 5 (20 rows) while the range to get Sumsales for the register client 19 is Sum(Sales) from client 1 (19 rows).

Thank you.

Regards

Alvaro

13 Replies
Anil_Babu_Samineni

Haha Sunny, From your reply he might seen only Three 19's. But he is expecting four 19's?

1197:34:563475319
1207:37:313077319
1217:39:464880019
1227:42:525483919
1237:45:255189020
1247:48:3255918 20
Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Then I expect the OP mention that this is what is not working. A simple 'doesn't work' is not very helpful

alvarogh27
Contributor II
Contributor II
Author

Hi Sunny,

Sorry for my short answer, it could seem that I didn't value your time and your great job. Sorry, I have no time and I tried one time and it doesn't work and I replied too quickly.

Today, I have tried again to run the application, and if I run your *.qvw in my computer, it works well, but if I copy and I paste in a new *.qvw, it doesn't work. I thought that it was for the format of Time.

In my qlikview app the format Time is:

SET TimeFormat='h:mm:ss';

SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fff]';

While in your *.qvw is:

SET TimeFormat='h:mm:ss TT';

SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

But, I changed this lines but it continues without to work.

I don't know why the Table2 is empty in a moment, and the columns upper and lower are not a time, is or empty or a number that is not a time.

When it creates the table2, Uppen and Lower I believe that Upper and Lower is not correct:

Finnally, I think that is a problem with de default formats, but is curious that doesn't work in my app-computer.

I'll try it to implement in my app, and I'll investigate why.

I was investigating to build a new column with the cumulative sum by checker, and after to make the difference between cumulative sum in a hour and the cumulative sum in a hour - 1 (with peek function), but the number inter-register is variable for the second cumulative sum and I don't know how make.

Again, Sorry for my comment and Thank you for your help. It's a great idea.

Regards, Alvaro.

sunny_talwar

I am guessing that you are going to be working on your end to make this work, right? Let us know how it goes and please share the final solution of how you got it to work (when it does)

Thanks,

Sunny