Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
New-here1
Contributor III
Contributor III

Calculate total sum between a date range

Hello,

I want a total sum/count for locations between 01/01/2023 - 12/12/2024. I have tried the below but the result is coming back as 0. 

SUM({$<[Effective_Start_Date]={">01/01/2023"}, [Effective_End_Date]={"<12/12/2024"}>}[Location])

It is worth noting that the effective start date has dates starting from 2020 and the effective end date has dates going up to 2026.

I just want to see the total between the two dates noted above.

Please could somebody help me

Thank you

Labels (3)
2 Solutions

Accepted Solutions
CezarioAbrantes
Contributor III
Contributor III

Hi,

Have you checked the points below yet?

1. Are your dates in date format ($numeric $timestamp)?
2. Do you really have records that satisfy both conditions?
3. Is Location a numeric field?

Regards

Cezário

View solution in original post

CezarioAbrantes
Contributor III
Contributor III

Hi Luce,

The answer #3 is the key for your issue. Try replacing Sum by Count instead. Perhaps you shoud use distinct as well, if your Locations are repeated and you want to count just once.

Regards

Cezário

View solution in original post

4 Replies
CezarioAbrantes
Contributor III
Contributor III

Hi,

Have you checked the points below yet?

1. Are your dates in date format ($numeric $timestamp)?
2. Do you really have records that satisfy both conditions?
3. Is Location a numeric field?

Regards

Cezário

New-here1
Contributor III
Contributor III
Author

Hi Cezario,

Thanks for your reply. 

To answer your questions:

1. Yes, my dates are in date format (dd/mm/yyyy)

2. The date that I require are definitely available - the data itself is 2020-2026

3. Location is not numeric, it is names of locations

Thank you 

Luce

CezarioAbrantes
Contributor III
Contributor III

Hi Luce,

The answer #3 is the key for your issue. Try replacing Sum by Count instead. Perhaps you shoud use distinct as well, if your Locations are repeated and you want to count just once.

Regards

Cezário

New-here1
Contributor III
Contributor III
Author

That worked, thank you 🙂