Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Question from new user about Variables

Please forgive me, I am brand new to Qlikview. I have a very simple request I'm sure. I want to create a new variable during the load script that sums orders by vendors. In the attached file I have 2 simple columns, a vendor ID and an Order ID and I simply want to create a new variable during the load script that I can re-use that shows the total number of orders for any selected vendor. I understand this can be achieved easily within Qlikview by using a count but I'm using this simple example to teach myself more about Qlikview and using variables. Any help is very much appreciated.

5 Replies
JonnyPoole
Employee
Employee

The expression would be count(distinct Order)  and the way to create such a variable is as follows in the load script:

let vNumOrders='count(distinct Order_id)';

The variable will be evaluated in what any context you insert it into. For example, the blue text box has no context so you get a global count.  The chart however is broken down by the dimension Vendor_ID so you get a count per vendor_id.

invoke the variable using dollar sign expansion wherever you use it:   $(vNumOrders)

sample.PNG.png

danieloberbilli
Specialist II
Specialist II

A variable can only have 1 value at a time - so doesnt work in your case, as each vendor can have another count of orders. Just use a straight table with Vendor as Dimension and count(Order_ID) as expression:

Capture111.PNG.png

Not applicable
Author

Thanks you very much. I may be heading down a wrong path however, but what I want to be able to do is search for all vendors who, for example, have 3 orders and have only those orders displayed. That's why I was thinking I need a variable but in actuality I am looking to create a new field for each vendoe that has a count of their orders. Does this make sense?

JonnyPoole
Employee
Employee

The 'threshold' value can be captured through a user input. Below is a drop down example with prefilled values 1-10.

Once selected the chart only shows vendors with >= the threshold value

Capture.PNG.png

danieloberbilli
Specialist II
Specialist II

Maybe somthing like this:

Capture000.PNG.png

Set a variable - control it via the slider. In the expression I am displaying all vendors with x>=number of orders