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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
coloful_architect
Creator II
Creator II

Load one data field into two with condition

Hi guys,

Now I have a dataset with price and price time.

at load scripts, how can I load the field of price and split it into two fields : current price and future price by time difference?

I know I can do two load flows with concatenate like:

Let vToday=today();

Load 

          product,

          price,

         time

From ..... where price < '$(vToday)';

Concatenate

 Load 

      product,

      price as future_price

     time

From....where price > '$(vToday)';

 

But is there a way to use like if function to achieve it at one batch of load without using concatenate ?

thanks

1 Solution

Accepted Solutions
Thiago_Justen_
MVP
MVP

Hi there,

Basically you could try this:

 

Load 

          product,

          If(time > today(), price,  0 ) as 'Future Price,

           If( time < today(), price, 0) as 'Current Price',

         time

From ..... 

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago

View solution in original post

1 Reply
Thiago_Justen_
MVP
MVP

Hi there,

Basically you could try this:

 

Load 

          product,

          If(time > today(), price,  0 ) as 'Future Price,

           If( time < today(), price, 0) as 'Current Price',

         time

From ..... 

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago