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

Comparing 2 date fields set analysis

I have tried to find an example for what seems like a basic set analysis expression - but can't find one that matches what I need. Just trying to return Revenue where the

Employee Last Date is <= StartTime_Date

but obviously my syntax is wrong. some of the examples I tried:

Sum ({<[Employee Last Date]={'<=$(=Date(([StartTime_Date])))'>}Revenue)

Sum({<[Employee Last Date]={'<=$(Date([StartTime_Date]))'>}Revenue)

Sum({<[Employee Last Date]={'<=[StartTime_Date]'>}Revenue)

Steve

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You might be running into another problem: set_analysis_intra-record.qvw

If both date fields are part of the same data table you create in the load script then you should add a flag field in this table:

LOAD

    EmployeeID,

    [Employee Last Date],

    StartTime_Date,

    if([Employee Last Date] <= StartTime_Date, 1, 0) As FlagField,

    ...other fields...

FROM ....

You can then use this field in your set analysis expression instead: sum({<FlagField={1}>}Revenue)


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

You might be running into another problem: set_analysis_intra-record.qvw

If both date fields are part of the same data table you create in the load script then you should add a flag field in this table:

LOAD

    EmployeeID,

    [Employee Last Date],

    StartTime_Date,

    if([Employee Last Date] <= StartTime_Date, 1, 0) As FlagField,

    ...other fields...

FROM ....

You can then use this field in your set analysis expression instead: sum({<FlagField={1}>}Revenue)


talk is cheap, supply exceeds demand
pokassov
Specialist
Specialist

Hello!

Sum ({<[Employee Last Date]={'[Employee Last Date]<=[StartTime_Date]'>}Revenue)

zagzebski
Creator
Creator
Author

Thanks. Think Gyspert caught my issue.

zagzebski
Creator
Creator
Author

Very helpful document. I all the Set analysis trainings I have experienced nobody went through this. Thanks!

zagzebski
Creator
Creator
Author

I do have one question.  In your example would everythign still apply if you took out (1) OrderDate, (2) Shipdate or (3) both OrderDate and ShipDate from your table. Would that change how your set would work?