Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
RuadriV
Contributor
Contributor

Variable or Master Item in Expression

Hello, I need help using a master item or variable in my expression,

The complete formula should be something like this

 

sum(IF(OpeningStock<MAX_LVL AND Range = 'RAN',((MAX_LVL - OpeningStock)*COST),0))

 

 

I need to create the "OpeningStock" value for which I am using

 

 

(((Sum({<[TXDATE.autoCalendar.YearMonth] = {'$(=$(vCurrentMonth))'},[TCODE]={'IN'}>} QUANTITY))
-
(Sum({<[TXDATE.autoCalendar.YearMonth] = {'$(=$(vCurrentMonth))'},[TCODE]={'CN'}>} QUANTITY))) + ONHAND)

 

Please let me know if I'm on the right patch

Labels (4)
3 Replies
MatheusC
Specialist II
Specialist II

Hi, @RuadriV 

Is OpeningStock your master item with the expression given below?

(((Sum({<[TXDATE.autoCalendar.YearMonth] = {'$(=$(vCurrentMonth))'},......

If so, I imagine that this part is bringing the correct value, so let's move on to the final calculation part.

Try this way

IF(OpeningStock <MAX_LVL Range = 'RAN',(MAX_LVL - OpeningStock)*COST,0)



Regarts,
Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
RuadriV
Contributor
Contributor
Author

The master item shows up in black text and I get an "Error in Expression" notice see screenshot

MatheusC
Specialist II
Specialist II

I used the fields provided.

If the master item has already been created for your expression, enter the name according to what was entered in “master items”.

If it has not yet been created, go to create new, entering the expression and name of the OpeningStock master item, as in your example.

MatheusC_0-1706797898311.png

MatheusC_2-1706797956402.png

 


Regarts,
Matheus

 

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!