Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
reivax31
Partner - Creator III
Partner - Creator III

Sum (sales) on a weekly scale but only sum one specific date in that week

Hi Qlikers,

I created a chart with dimensions MyDate and measure sum(sales). I use alternative dimensions (my week, my month, etc...) table is like :

 

MyDateMyWeekSales
15/01/2018310
16/01/2018311
17/01/2018312
18/01/2018313
19/01/2018314
20/01/2018315
21/01/2018416
22/01/2018417
23/01/2018418
24/01/2018419
25/01/2018420
26/01/2018421

So right know when I switch my dimension to MyWeek I will have a sum of all my values in that week. I would like to only peek the max date of that week. So for week 3 the value should be 15  and for week 4 value is 21...

Any idea ? thanks for your help

24 Replies
reivax31
Partner - Creator III
Partner - Creator III
Author

Hi,

this one returns blank chart. I tried some variant but I didn't get it

brunobertels
Master
Master

Hi

What is your desired outpout exactly

Wich dimension ? Date or Week , or both ?

See below that in a simple table both last expression proposed works fine with Dimension MyWeek

Capture.PNG

zebhashmi
Specialist
Specialist

=Max(aggr(Sales,MyDate))

reivax31
Partner - Creator III
Partner - Creator III
Author

Hi,

Yes I want to make it work with both (MyDate, MyWeek).

for this one it work: max(aggr(sum(aggr(sum(Sales),MyDate,MyWeek)),MyDate)) but only if the last day of the week has the highest Sales Value. In the table change the sales value to something lower than 14 for 20/01/2018. ex:

20/01/2018310

for Max(aggr(aggr(Sales,MyDate,MyWeek),Sales)) I really just have blank returned. (maybe because MyWeek is in correspondance table) it not a flat data but a calendar table that converts Dates in orther forms like week, month, year ,etc

reivax31
Partner - Creator III
Partner - Creator III
Author

Hi, itreturns blank value in my chart ...

brunobertels
Master
Master

Hi

Ok Xavier

But what is your desired output finally :

Ex Do you want somethink like MyMesure 1 or MyMesure 2

  

MyDateMyWeekSalesMY MESURE My MESURE 1
15/01/201831014-
16/01/201831114-
17/01/201831214-
18/01/201831314-
19/01/20183141414
20/01/201831014-
21/01/201841621-
22/01/201841721-
23/01/201841821-
24/01/201841921-
25/01/201842021-
26/01/20184212121
agigliotti
Partner - Champion
Partner - Champion

Why you need to display the same value for all dates within the week ?

Do you also need its total ?

reivax31
Partner - Creator III
Partner - Creator III
Author

Sorry maybe I didn't explain well what I'm trying to do:

MY MESURE should be one and only measure that gets me the result bellow if I use MyDate or MyWeek. (the purpose is to use alternative dimension so the user can swicth between a day or week view, so when user select a week view I only want to show the last value of the week)

MyDate

sum(Sales)MY MESURE
15/01/20181010
16/01/20181111
17/01/20181212
18/01/20181313
19/01/20181414
20/01/20181010
21/01/20181616
22/01/20181717
23/01/20181818
24/01/20181919
25/01/20182020
26/01/20182121
MyWeekSum(Sales)MY MESURE
37010
411121
reivax31
Partner - Creator III
Partner - Creator III
Author

Ok, imagine on monday a certain Item had the value 10, then on tuesday 11, ... and at the end of the week 10. If user select a day view (MyDate) then he can see the evolution of the item value day after day. But if user swith to a week view because he wants to see week after week the evolution of that item (not sum all the value within the week and also not doing an average that could be easely done). So the rule is that the last value of the week is the value that is the reference, even if during the week the value of the item may have changed

agigliotti
Partner - Champion
Partner - Champion

take a look at https://community.qlikview.com/thread/258160

I'd suggest you to follow that thread because there is no way to detect the active dimension.