# Qlik Sense App Development

Announcements
cancel
Showing results for
Did you mean:
Contributor III

## Qlik sense set-analysis on chart dimentsion

Hi!

I'm trying to show reports vs time for an operation and compare it with a target. The target can't be measured normally on on the coating operation operation. Instead I want to have the target as a function of OrderQTY and CarrierQTY.

The expression looks like this:

Sum({\$<\$(CoatingOperations)>}[Target]) /
( sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>}[OrderQTY])/
sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>}CARRIERQTY)
)

and

sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>}[OrderQTY])/
sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>}CARRIERQTY)  should evaluate to a constant value of e.g. 250 based in the last 90 days.

What we will have is then

Sum({\$<\$(CoatingOperations)>}[Target]) / 250

Seems straight forward? But in a bar graph which has Target vs date. It doesn't get a constant value. It's evaluated for every single date. How can I define a value that is evaluated for certain selections before it's evaluated in the graph?

The target should change for every date, but orderQTY/CarrierQTY should be a constant evaluated for the last 90 days.

I've tried to include Date=, so the latter part should ignore the dimension. But that means I can't make any date selections anymore, which is relevant to see the target for different date. How can I calculate a constant in the front end and use it in visualisations?

sum({\$<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}[OrderQTY])/
sum({\$<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}CARRIERQTY)

Thanks for replies

Edvard

Labels (3)

• ### Set Analysis

1 Solution

Accepted Solutions

Override the dimensions with TOTAL:

sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>} TOTAL OrderQTY)/
sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>} TOTAL CARRIERQTY)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
8 Replies

May be try this way

sum({1<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}[OrderQTY])/
sum({1<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}CARRIERQTY)

Or

If(GetSelectedCount(Date)>0,

sum({1<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}[OrderQTY])/
sum({1<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}CARRIERQTY)
,

sum({\$<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}[OrderQTY])/
sum({\$<FlagLast90Days={'1'},Date=, \$(CoatingOperations))>}CARRIERQTY)
)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor III

It will still count the KPI (Target/(orderQTY/CarrierQTY) different for each single day of the week. I know and have checked that the target is constant during most weeks, it changes between weeks and some individual days of the year.

I want to calculate a sum(OrderQTY)/sum(CarrierQTY) variable that should be based on the last 90 days. Then divide the daily target with that constant numerical value and be able to do date selections. But the OrderQTY and CarrierQTY will change depending on the date selections and if I exclude the date selections it won't be agile and in a bargraph it will still do the calculations based on date, even if it's excluded in set analysis since it's a dimension.

What is the "CoatingOperations"?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor III

It's a visualisation for a production and especially target exists for multiple operations, but specifically the coatingoperation measures vs their OrderQTY/CarrierQTY. basically, that's inhouse specific selection.

How did you define the variable?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor III

That vairable is unfortunatlely not the issue, it's just a setanalysis for selection specific operations. I'm using it and similar on many places elsewhere in the visualizations, therefore I put it in a variable instead, to be able to change at one place instead of many.

But if I could do that to the latter part it would solve the problem. when I make a variable of sum(OrderQTY)/sum(CarrierQTY) with all the set analysis for selections. When I use it, the variable expansion put's in the code in the function and evaluating there, which interfere with my dimensions and selections.

vL.factor = sum(OrderQTY)/sum(CarrierQTY) = e.g. 250

How it is:

f(x) = Target/\$(vL.factor) = Target / sum(OrderQTY)/sum(CarrierQTY)

How I need it, because of the set analysis inside vL.factor
f(x) = Target /\$(vL.factor) = Target / 250

Is it more clear now what I'm searching for? Is this possible in anyway?

Override the dimensions with TOTAL:

sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>} TOTAL OrderQTY)/
sum({\$<FlagLast90Days={'1'},\$(CoatingOperations))>} TOTAL CARRIERQTY)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Contributor III

Thanks! This seems to be giving the correct result! Have to read up more on how that keyword works 😉

Thanks again

Regards

Edvard