Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
retko1985
Creator II
Creator II

Use different column for some period.

Hello,

 

We have a business rule to use different data for year 2018, since there are no data for 2018 on primary source.

I prepared some use case QVW.

My Data:

LOAD * INLINE [
ID, Year, Amount1, Amount2
1, 2018, 100
2, 2018, 200
3, 2018, 300
4, 2018, 400
5, 2018, 500
6, 2018, 600
7, 2018, 700
8, 2019, 5000, 800
9, 2019, 6000, 900
];

 

 

Primary source is Amount2, but for 2018 I want to use Amount1.

I dont want to do big changes in my expression. So the question is, ho to do it best? Probably with set analysis. (better without IFs).

 

What I want in straight table, is this:

yearAmount
20182800
20191700

 

Thank you for help.

1 Reply
PrashantSangle

You can do changes in script so that you don't required changes in front end
try below

1st apporach
LOAD ID,if(Year='2018',Amount1,Amount2) as Amount INLINE [
ID, Year, Amount1, Amount2
1, 2018, 100
2, 2018, 200
3, 2018, 300
4, 2018, 400
5, 2018, 500
6, 2018, 600
7, 2018, 700
8, 2019, 5000, 800
9, 2019, 6000, 900
];

2nd Approach
In front end use Alt()
Alt(Amount2,Amount1)

Regards,
Prashant
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 🙂