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

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count ID per Value in script

Dear all,

another month, another try [:)]

I need to count out the number of IDs during a value. This should be done in the script, what looks like this:

Main.Data:
Load
ID AS CountIDMin,
Start,
End,
Date
Resident Original.Data;

LEFT JOIN (Main.Data)
INTERVALMATCH (Datum_time)
LOAD
Start,
End
RESIDENT Original.Data2;


Final.table:
Load
CountIDMin,
Start As StartMin,
End as EndMin,
Date as DateMin,
Datum_time
RESIDENT Main.Data;

Final.Count:
Load
Date_time,
Count(CountIDMin) AS Count
Resident Main.Data
Group by Datum_time;


Unfortunately the result in a simple table in the layout looks like the attached jpeg. Instead of the expected result "8" the column Count shows "17".

Maybe there is something wrong in the script?

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Try count(distinct ...)

View solution in original post

3 Replies
Not applicable
Author

Try count(distinct ...)

Not applicable
Author

Thanks for the quick reply Pascal. This was my foremost thought too, because 17 would be the correct result if I take the whole raw dataset instead of a subtotal. Unfortunately the result remains the same, even using the distinct function.

In my original data 2 synthetic keys will be created in the script. Maybe this is a problem? (Even I have ben working with QV since some month now, I am still not familiar with all its functions... )

Not applicable
Author

you are right Pascal - it of course distinct. Also I just avoid using synth. keys and it works fine now.