Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
DanielSchneider
Contributor
Contributor

Using if statements in data load

Hello,

I am having trouble getting used to the syntax in QlikSense (used to matlab). I am trying to have another column loaded into my data so I can create a line chart using both the Test and the Week as variables on the x axis.

Here is where I am having trouble:

LOAD
    LogDate,
    Date(LogDate,'MM/DD/YYYY') as calDate,
    WeekDay(LogDate) as Day,
    Week(LogDate) as Week,
    Hour(LogDate) as HourW1
    Hour(LogDate)-168*Week) as HourW2
    IF (Week=1,HourW1,Hour=Hour(LogDate)-168*Week)
    then
     <Hour=Hour(LogDate)>
    else 
    < Hour=Hour(LogDate)-168*Week>
    IF(Hour=>0 && Hour<54)
    Test=ClgMaxLoad1
    Elseif(Hour=>54 && Hour<90)
    Test=HeatingFlood
    Elseif(Hour=>90 && Hour<126)
    Test=ClgMaxLoad2
    Elseif(Hour=>126 && Hour<162)
    Test=ODFanFail
    Elseif(Hour=>162)
    Test=OFF

 

 

Any help is appreciated,

Daniel

2 Replies
sunny_talwar

Can you put in words what your condition is doing?

DanielSchneider
Contributor
Contributor
Author

Hi Sunny,

Our testing runs the same week long program for one week, with different tests running for specified hours.

The condition first converts the loaded date into hours, checks if it is after week one ( subtracts hours until it is in the same week long format), then outputs the test according to what hour it is on.

 

Hopefully that is descriptive enough.

Daniel