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

Seeing last week WITH sales even though i have not selected a week

Dear QV-users,

I have a difficulty. I want to see last week's sales. This i can do. What i find a challenge is this:

If i don't select a week i want to see the last week WITH sales. For the moment, when i select nothing i see week 52, but i have no sales for that week. I want to see my sales for week 51, because i had sales in that week.

This is my script:

LOAD

* INLINE [

    Jaar, Week, Sales

    2000, 1, 12

    2000, 2, 12

    2000, 3, 34

    2000, 4, 352

    2000, 5, 2

    2000, 6, 23

    2000, 7, 5

    2000, 8, 12

    2000, 9, 12

    2000, 10, 34

    2000, 11, 352

    2000, 12, 2

    2000, 13, 23

    2000, 14, 5

    2000, 15, 12

    2000, 16, 12

    2000, 17, 34

    2000, 18, 352

    2000, 19, 2

    2000, 20, 23

    2000, 21, 5

    2000, 22, 12

    2000, 23, 12

    2000, 24, 34

    2000, 25, 352

    2000, 26, 2

    2000, 27, 23

    2000, 28, 5

    2000, 29, 12

    2000, 30, 12

    2000, 31, 34

    2000, 32, 352

    2000, 33, 2

    2000, 34, 23

    2000, 35, 5

    2000, 36, 12

    2000, 37, 12

    2000, 38, 34

    2000, 39, 352

    2000, 40, 2

    2000, 41, 23

    2000, 42, 5

    2000, 43, 12

    2000, 44, 12

    2000, 45, 34

    2000, 46, 352

    2000, 47, 2

    2000, 48, 23

    2000, 49, 5

    2000, 50, 352

    2000, 51, 2

    2000, 52,

]
;

This is my current expression:

Sum

({<

Week = {$(=Max(Week))},

Jaar = {$(=Max(Jaar))}

>}
Sales)

THis is my expression in which i want to try to create a solution to see the last week WITH sales if i don't select a week

Sum

({<

Week = {$(=max({<Sales =    {">0"}>} Week))},

Jaar = {$(=Max(Jaar))}

Sales)

1 Solution

Accepted Solutions
shahamel
Creator
Creator
Author

Sum

({<

Week = {$(=Max(Week))},

Week = {$(=max({<SalesPriceBrut =    {">0"}>} Week))},

Year = {$(=Max(Year))},

SalesPriceBrut =    {">0"}

>}
SalesPriceBrut)

This expression works, but you have to build in every dimension u are using wihting the object in which you use this expression

View solution in original post

1 Reply
shahamel
Creator
Creator
Author

Sum

({<

Week = {$(=Max(Week))},

Week = {$(=max({<SalesPriceBrut =    {">0"}>} Week))},

Year = {$(=Max(Year))},

SalesPriceBrut =    {">0"}

>}
SalesPriceBrut)

This expression works, but you have to build in every dimension u are using wihting the object in which you use this expression