Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
sbousfield
Contributor
Contributor

Set Analysis/Sum IF

Hi all,
I'm new to this platform, and I'm trying to create a KPI that displays the number of individual countries with greater than 200 cases since a specific date (this is case data of a particular disease).

 

I've tried to use set analysis to filter the data by country and the date greater than, however the set expression for date does absolutely nothing.

Trying to do simply the sum of cases "sum({<date={'>2020-05-01'}>*<country={'Australia'}>}new_cases)" results in 0, which is the incorrect answer, and even when the answer is not zero, the date part has not effect.

I would really appreciate help.

 

Thanks in advance

 

Labels (3)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

while loading the field in data load editor

try below

Date(Date#(Trim(cases.date),'YYYY-MM-DD')) as cases.date

 

also are you using the  correct field name? can you post a screenshot of the expression editor?

 

sum({<cases.date={">2020-05-01"},country={'Australia'}>} new_cases)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

6 Replies
vinieme12
Champion III
Champion III

1) specify multiple criteria's separated by a comma (,)

 

2) Ensure the datevalue format matches the format of the "date" field

2020-05-01 must match the date values in "date" field

 

sum({<date={">2020-05-01"},country={'Australia'}>} new_cases)

 

refer below

https://community.qlik.com/t5/Design/Dates-in-Set-Analysis/ba-p/1472511

 

https://www.datameer.com/blog/greater-than-less-than-and-dates-in-qlik-set-analysis/

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sbousfield
Contributor
Contributor
Author

According to the Data Manager, the date format is YYYY-MM-DD.
sum(new_cases) returns "203.5M" (the correct value)

The earliest date is 2020-01-01. sum({<date={">=2020-01-01"}>}new_cases) returns "0".

Trying to use the date set analysis seems to be creating issues.

vinieme12
Champion III
Champion III

is your datefield actually DATE ?

 

trying doing =isnum(yourdatefield);  if it returns -1, then the field is formatted correctly as dates

 

Can you also post a snapshot of your datefield?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sbousfield
Contributor
Contributor
Author

That function returns 0, I guess its not a date?

sbousfield_1-1666949662343.png

sbousfield_2-1666949724371.png

 

 

sbousfield
Contributor
Contributor
Author

I added

Date(floor("date"), 'YYYY-MM-DD') AS "date"

to the Data Load Script, and things seem to work now

vinieme12
Champion III
Champion III

while loading the field in data load editor

try below

Date(Date#(Trim(cases.date),'YYYY-MM-DD')) as cases.date

 

also are you using the  correct field name? can you post a screenshot of the expression editor?

 

sum({<cases.date={">2020-05-01"},country={'Australia'}>} new_cases)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.