Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

If Condition in Where Clause in Load statement

Where Condition for Load Script
Create Year should be less than 2021 
If Stage =A then Close Year should be less than 2021 else no restriction for Close Year 

Result: (Exclude highlighted in Yello)

Capture.JPG

T1:
LOAD * INLINE [
ID, Stage, Create_Yr, Close_Yr
1, A, 2018, 2018
2, A, 2018, 2021
3, C, 2017, 2020
4, C, 2018, 2018
5, A, 2018, 2021
6, D, 2018, 2020
7, D, 2018, 2020
8, E, 2021, 2022
9, E, 2018, 2023
10, H, 2021, 2025
];

1 Solution

Accepted Solutions
BtBread
Creator
Creator

Hello.
my suggestion:

T1:

LOAD * INLINE [
ID, Stage, Create_Yr, Close_Yr
1, A, 2018, 2018
2, A, 2018, 2021
3, C, 2017, 2020
4, C, 2018, 2018
5, A, 2018, 2021
6, D, 2018, 2020
7, D, 2018, 2020
8, E, 2021, 2022
9, E, 2018, 2023
10, H, 2021, 2025
]

Where (Create_Yr<2021) and not (Stage='A' and Close_Yr>2020)

;

View solution in original post

1 Reply
BtBread
Creator
Creator

Hello.
my suggestion:

T1:

LOAD * INLINE [
ID, Stage, Create_Yr, Close_Yr
1, A, 2018, 2018
2, A, 2018, 2021
3, C, 2017, 2020
4, C, 2018, 2018
5, A, 2018, 2021
6, D, 2018, 2020
7, D, 2018, 2020
8, E, 2021, 2022
9, E, 2018, 2023
10, H, 2021, 2025
]

Where (Create_Yr<2021) and not (Stage='A' and Close_Yr>2020)

;