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

Date variable in a expression

I have this expression with a costant limit :

SUM(if(data<= '15/01/2014' ,SALDO,0))

if i want to insert a date store in a variable genn_data i wrote

sum(  {$<data<=$(genn_data)>} SALDO)

but don't return the same value. What is wrong ?

1 Solution

Accepted Solutions
mangalsk
Creator III
Creator III

Hello,

Kindly find the attachment where

I have changed variable

genn_data=='15/01/'&ANNO

and expression to SUM(if(data<= genn_data ,SALDO,0))

Now its giving correct value if year 2014 selected.

Regards,

Mangal

View solution in original post

19 Replies
SunilChauhan
Champion
Champion


sum(${<data={"<=$(=Date(genn_data,'DD/MM/YYYY'))"}>}SALDO)

Sunil Chauhan
MK_QSL
MVP
MVP

SUM({$<data = {'<=$(genn_data)'}>}SALDO)

alexandros17
Partner - Champion III
Partner - Champion III

sum(  {$<data={'<=$(genn_data)'}>} SALDO)


but you must pay attention to data format

PrashantSangle

Hi,

Try this,

sum({$<data={"<=$(genn_data)"}>} SALDO)

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
ThornOfCrowns
Specialist II
Specialist II

What do you get back?

You are probably missing some quotes around your expression i.e. "<=$(genn_data)"

massimo6919
Contributor
Contributor
Author

when i use costant value the return is     -120953,3

with the alternative give me i obtain         -134040,26

PrashantSangle

Hi,

Then First Convert into date Format like,

sum({$<data={"<=$(=Date(genn_data,'DD-MM-YYYY'))"}>} SALDO)


Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable

Hi,

try like this

Sum(data={"<=$(genn_data)"}>} SALDO)

Note: Your variable giving DD/MM/YYYY format and your field data should also be in the same format

Not applicable

Massimo,

When doing such date comparisons, I would recommend you to store an integer into your variable with the num function:  num(theDateYouWant) or date#()

The comparison will be easier (no date format to write) and certainly safer.

Fabrice