# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$300 before February 6: REGISTER NOW!
cancel
Showing results for
Did you mean:
Specialist

## how do i put this needed result in a textbox value

i have this pivot;

dimension: material

expression : MAX(quantity),SUM(safetystock),[quality]-[safetystock]

i want to put the count on the results where quality-safetystock < 0 into a textbox.

So i want in a textbox how many materials are below safetystock.

how does this expression look like?

1 Solution

Accepted Solutions
Specialist
Author

SUM(IF(AGGR((MAX([Quantity]) - SUM([SafetyStock])),[MaterialID]) < 0,1))

6 Replies
Employee

Hello Amien,

Not sure if I understood you right (I'm assuming the labels are respective to the Max() and Sum() function), but if that returns more than one line, use better a straight table without dimensions with something like the following:

`Count({< ID = {"=Max(quantity)", "=Sum(quality - safetystock) < 0"} >} ID)`

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Specialist
Author

Yes those are the labels of max() and sum()

only your formula doesn't give me the end result that i need.

If i have this in an expression:

IF(MAX(Quantity) - SUM(SafetyStock) < 0,1,0)

i need the sum of that (all the '1') into a single textbox

Employee

Hi,

Then try something like

`Count({< ID = {"=Max(Quantity) - Sum(SafetyStock) > 0"} >} ID)`

I'm using the "ID" as the field that identifies those Quantity and SafetyStock (Items maybe)?

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Specialist
Author

same result

btw ..

not items, but plants.

each plant has different quantities on each material (max)

i dont really need to see the plant

and each material has a needed safety stock which is only one per material (sum)

so the sum is not really needed cause all materials only have one safety stock

Specialist
Author

Dear Miguel,

i have added an example .. in my textbox/button .. i need the value '2'  .. because 2 materials are below safetystock

Specialist
Author

SUM(IF(AGGR((MAX([Quantity]) - SUM([SafetyStock])),[MaterialID]) < 0,1))

Community Browser