Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
test_engineer
Contributor
Contributor

Sum with clause not working 100%

Hello,

I have a table with a start of week column (i.e. 2022-01-24 was last week start, Monday) and a counts columns.

i.e.

start_week event  week_event_counts
2022-01-24 a 10
2022-01-24 b 12
2022-01-17 a 3
2022-01-17 b 9

 

If I do the below it's as expected, 22.

 

 

 

sum({<start_week = {"2022-01-24"}>} [week_event_counts])

 

 

 

 If I do the below the result is zero (0). What is the cause of this?

 

 

 

sum({<start_week = {"$(=max(start_week))"}>} [week_event_counts])

 

 

(also I checked out that max(start_week) works fine in isolation)

 Regards,

Labels (1)
1 Solution

Accepted Solutions
chrismarlow
Specialist II
Specialist II

Hi,

Qlik can do some odd things with dates ... assuming in my toy app I've got similar settings to you then I think the formula has changed the date into a number ... you can see this in edit expression;

20220201_3.png

I think you would then want to format this to match your expression.

Cheers,

Chris.

View solution in original post

2 Replies
chrismarlow
Specialist II
Specialist II

Hi,

Qlik can do some odd things with dates ... assuming in my toy app I've got similar settings to you then I think the formula has changed the date into a number ... you can see this in edit expression;

20220201_3.png

I think you would then want to format this to match your expression.

Cheers,

Chris.

test_engineer
Contributor
Contributor
Author

ah sorted. I didn't know about the visualisation bit a the bottom. Ace. Just had to match the format!!!

I my case in-case it is helpful to anyone it was:

 

{"$(=Date(max([start_week]), 'YYYY-MM-DD'))"}