Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Viallijk
Contributor
Contributor

Calculate data in Expression with data in Load Editor

Hello Everyone i want to ask about how i can get a data like Picture Number One in Column Cogsacal :

Picture Number One

Viallijk_0-1661229270314.png

In column number one in Cogsacal is data is the same like Cogsa, in column three the data can get by using formula (38*cogsa in date 21/04/2022) + (20* Cogsa in date 12/05/2022)/ 58 in stock

For my Question How to get a data using a expression ?  i try using this fromula 

if(RowNo()=1,Cogsa,((Above(If(RowNo()=1, Stock)))) * Above(cogscal)) + Cogsa
/ Stock 

But the data i get is not correct 

for Stock and Cogsa is calculate in load editor 

Viallijk_2-1661230140994.png

 

and for my second Question 

How can i get like table have above ? 

For example in table a column date 1/4/2018 and 1/5/2018 is empty and after using expression i using above i want to get data in date 1/4/2018 is 23

Viallijk_1-1661229874221.png

Please Help me to resolve my problem 

Thank you

 

1 Reply
henrikalmen
Specialist
Specialist

This should possibly have been posted as two separate questions. I'm not sure I understand your first question - what it is you want to achieve - but here's an attempt on your second question.

If I understand correctly you have two coklumns, "date" and "A..."., and you want to create a new column named "Above". To avoid confusion, I'm renaming the resulting column to "Resultcolumn" and the expression for that column could then be written like this:

 

if(rowno(total)=1,[A...],
   if([A...]>0, [A...], above(total [Resultcolumn]))
)

 

This should work with your exact example, but it may not work with your actual data. The first row will get the value in column [A...]. For the following rows, check if the value of [A...] is greater than 0. If it is, set the value of Resultcolumn to the value of column [A...], otherwise use the previous value in Resulcolumn.

It is important that the name of the expression column corresponds to the name in the formula, since the formula is calling its own column by using its name.