Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Perhaps using DISTINCT, like:
Load DISTINCT
[Date],
[department],
[activity],
[uom]
From <>;