Qlik Community

Ask a Question

QlikView Documents

QlikView documentation and resources.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER

How to use - Only()

robert_mika
Master III
Master III

How to use - Only()

Have you ever wondered how the examples from the Qlikview help may look like?

Please see below and enjoy responsibly...

Only()

Definition:

If expression or field iterated over the chart dimension(s) contain one single value, that value is returned, else NULL is returned. Only can return numeric values as well as text values.

What does it mean:

When in dimension(column) all values are

the same ,Only will return this value:

                                        (otherwise NULL)

Please load below script and look at our examples:

load * inline

[ Sales,Price,Quantity,Salesman

10,3,10,Robert

10,2,20,Robert

10,3,10,Henric

10,2,20,Oleg

10,4,20,John

10,3,10,Tom

]

After reload our TableBox looks like this:

Now we can create Straight table and used Salesmen as dimension:

1) only(Sales) returns 10 as this is the only single value in this column

2) only(Price*Quantity ) will not return any values for Robert as the the values returned are 60 (2*30) and 30(1*30).

( We will come back to our Salesman later)

Now let's add another dimension -  Price

This time expression will return values for Robert as it will see the combination of dimensions

Robert 2

Robert 3

as one (single) values.

(If you still in doubt go to our script and  change the Price  for Robert in second row to 3)

Let's go back to our example number 3 - only(TOTAL Salesman)

(The Example below is based on help from Henric Cronstrom

as I could not get my head around this expression and where can be used)

When you look at the expression you may wonder why we have TOTAL here.

In most cases you will uses this prefix to get numerical total like:

But TOTAL can also return string value.

If we choose one value from Salesman dimension

only(TOTAL Salesman)  will return this value.

Bonus:

As an aggregation function, only() can be used with set analysis


only({<Price={2}>} Quantity)


is used return Quantity for Salesman where Price is equal to 2.

Still feeling hungry?

How to use - Only()

Do you Qualify?- How to use QUALIFY statement

How to use - Dimensionality()

Missing Manual - GetFieldSelections() + Bonus Example

MaxString & MinString - How to + examples

The second dimension... or how to use secondarydimensionality()

How to use - MissingCount()

How to use- Dual()

Expression Scene Investigation, E1: Moving Average

Comments
chrisg
Partner
Partner

Many thx!

PavanNallani
Creator II
Creator II

Many thanks and good knowledge shared here

beck_bakytbek
Master
Master

Cool stuf, thanks a  lot for sharing

Shisho_Karsenty
Contributor III
Contributor III

Thanks u for sharing.
A small note:
There is no data correlation between the "loading inline" and the "TableBox",

for example Oleg quantity (20 and 40).

0 Likes
Not applicable

Very nice and clear  explanations till "only(TOTAL Salesman)  will return this value."  Would you explain what is (TOTAL Salesman) doing here?  Thank you so much!

0 Likes
Version history
Revision #:
1 of 1
Last update:
‎2015-03-19 01:53 AM
Updated by: