Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
retko1985
Contributor 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

Re: Use different column for some period.

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.