Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
MiguelHathaway
Contributor II
Contributor II

Need help with a variant (?

Hi, i'm New at Qlikview, and i'm trying to simplify my code but i can't do it.For example this is my code when I load information from an excel source.

Load
Period,
[Company Code] as [CC],
Amount,
Amount * -1 as [Negative Amount],
[Negative Amount] /1000 as [Neg Amount in miles]

The code write with Bold, doesn't work, probably because "[Negative Amount]" it's not recognized from the source of the excel. But I need it to work, cause i'm on more complex formulas, and I need them to look easy to understand. 

YourTexasBenefits

Pleasee help,

 

Labels (2)
4 Replies
vchuprina
Specialist
Specialist

Hi,

Try this:

Load *,

[Negative Amount] /1000 as [Neg Amount in miles];

Load
Period,
[Company Code] as [CC],
Amount,
Amount * -1 as [Negative Amount] 

From your excel;

Regards, 

Vitalii

 

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
smith11484
Contributor II
Contributor II

Try something like this, it's called a preceding load. You can transform data then load it again, and reference newly created columns, as it's all in memory. That's what the 2nd load statement is doing

Load [Negative Amount] / 1000 as [Neg amount in miles], *; Load Period, [Company code] as CC, Amount, Amount * -1 as [Negative Amount]

official website

SadlerS
Contributor III
Contributor III

Cough, runny nose, fatigue, sore throat, headache, muscle pain, fever and sneezing - are the 8 Omicron symptoms that are flu-like.
 
NitinK7
Specialist
Specialist

Hi,

Try this:

Load
Period,
[Company Code] as [CC],
Amount,
Amount * -1 as [Negative Amount],

(Amount * -1)/1000 as [Neg Amount in miles];

From your excel;