Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculated Dimension: first value

Hi guys,

I'm not sure what the best way to do this is. I'm creating a pivot table which displays information on certain orders. For one of the dimensions I'm displaying, I only want the first value that comes up. I've used firstsortedvalue before, but in this case I don't actually want to sort them by anything, I just want the first record that is stored for that field. I tried using the First() function but I got the "//error in calculation" message displayed in the table.

I also tried creating an entirely new field on the data import using the firstvalue command but that also seemed to cause a problem. Any ideas?

Dan

5 Replies
stephencredmond
Partner - Specialist II
Partner - Specialist II

Hi Dan,

If you use a set - perhaps using FirstSortedValue - in your expression then the other values will be zeroed and suppressed by default.

Regards,

Stephen

Not applicable
Author

Hey Stephen,

can you elaborate on this? I'm not sure what you mean.

Dan

stephencredmond
Partner - Specialist II
Partner - Specialist II

Hi,

If I have a dimension, say it is called "MyDimension", that has 3 values - A, B, C. If I want to show a chart that has only results from Value = A, I can do that by putting a set in my expression:


sum( { < MyDimension = {A} > } Sales )


Now the chart will not display B or C because one of the default options in the presentation tab is to suppress zero results.

Regards,

Stephen

Not applicable
Author

ah I see. Interesting functionality but not something that I can use. This field contains a set of entries for each order which aren't necessarily the same for each order. Creating a set would possibly eliminate correct values for other orders.

Not applicable
Author

is there a way to enforce that a field only contains a single value?