Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare field in Set Analysis

Hi all,

See below expression in Pivot table,

its working on first condition but not working on second.

Its does not pick up the Sdate field.

(see attached pic when I hover the mouse on column we can't see Sdate selected its Show {'>= <=18/03/......}

if(vFromDate > Sdate1,sum({<T_Date= {'>=$(vFromDate) <=$(vToDate)'} >}Tday),
sum({<T_Date= {'>=$(DATE(Sdate)) <=$(vToDate)' }>} Tday))

What is wrong in above expression?

FYI:

vFromDate & vToDate are Variables

Sdate, T_Date & Tday are fields

Set Analysis.PNG.png

8 Replies
PrashantSangle

Hi,

It looks like issue not with 'Sdate'

try this,

if($(vFromDate) > Sdate1,sum({<T_Date= {'>=$(vFromDate) <=$(vToDate)'} >}Tday),
sum({<T_Date= {'>=$(DATE(Sdate)) <=$(vToDate)' }>} Tday))


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 🙂
daveamz
Partner - Creator III
Partner - Creator III

Hi,

     You missed out a "=" in $(DATE(Sdate))

Try:

if(vFromDate > Sdate1,sum({<T_Date= {'>=$(vFromDate) <=$(vToDate)'} >}Tday),
sum({<T_Date= {'>=$(=DATE(Sdate)) <=$(vToDate)' }>} Tday))


Regards,

David

Not applicable
Author

No its not Working. still same, it not start from Sdate when condition is wrong.

Regards

Vinay


Not applicable
Author

No its same.

Actually want I want...

If vFromDate>Sdate then

     sum of Tday between vFromDate to vToDate

          else

      sum of Tday between Sdate to vToDate


sunilkumarqv
Specialist II
Specialist II

Try this


if(vFromDate >Sdate1 ,sum({<T_Date= {'>=$(vFromDate) <=$(vToDate)'} >}Tday),sum({<T_Date= {">=$(=(Sdate))<=$(=(vToDate))"}>} Tday))

Not applicable
Author

I have tried without DATE but still not working.

if(vFromDate > Sdate1,sum({<T_Date= {'>=$(vFromDate) <=$(vToDate)'} >}Tday),
sum({<T_Date= {'>=$(Sdate) <=$(vToDate)' }>} Tday))

also tried..

if(vFromDate > Sdate1,sum({<T_Date= {'>=$(vFromDate) <=$(vToDate)'} >}Tday),
sum({<T_Date= {'>=(Sdate) <=$(vToDate)' }>} Tday))

all above expression it give me result but its wrong. It dose not start with Sdate when condition is not satisfied.

CELAMBARASAN
Partner - Champion
Partner - Champion

I don't know how your data model is, but I hope below will work

if(vFromDate > Sdate1, sum({<T_Date= {">=$(=vFromDate)<=$(=vToDate)"} >}Tday),
sum({<T_Date= {"=T_Date>=Sdate and T_Date <=$(=vToDate)" }>} Tday))

Not applicable
Author

Hi Celambarasan,

No its still same and give me wrong sum of Tday.

see attached, when I hover mouse on column show Sdate1 as its is but is suppose to display some date.

if I use below expression with hard coded date instead of filed Sdate1 then its working fine.

if(vFromDate > Sdate1,sum({<T_Date= {'>=$(vFromDate) <=$(vToDate)'} >}Tday),
sum({<T_Date= {'>=10/03/2014 <=$(vToDate)' }>} Tday))

So why can't use field Sdate1?

Set Analysis1.PNG.png