Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unique combination of fields

My qlikview-file exists of 1 big table.

In this table a combination of fields should be unique.(However the input has to be correct)

What would be a good way to check if a combination of fields within a table is indeed unique?

Let's say I want t check if the combination of the fields:

[Date], [department], [activity], [uom]

is unique at the time the script is reloaded

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

There are a couple of ways to do it depending on what you want to do if you have duplicates.

CountTable:

LOAD Sum(1) as ComboCount

RESIDENT MyTable

GROUP BY [Date], [department], [activity], [uom]

;

IF NoOfRows('CountTable') < NoOfRows('MyTable') THEN

  TRACE Non-Uniques values in MyTable;

ENDIF

tresesco
MVP
MVP

Perhaps using DISTINCT, like:

Load DISTINCT

          [Date],

          [department],

          [activity],

          [uom]


From <>;