Hi all!
I have just started using LookML and I wanted to create a test that will allow me to know if there are duplicate values in my final table in Looker. For this test, I am using primary_key column and this is how I have wrote the test. The logic I followed is that if there are the same number of distinct primary key values to the count of primary key values, means that there are no duplicates.
test: no_duplicate_values {
explore_source: orders {
column: primary_key {
field: orders.primary_key
}
}
assert: no_duplicate_values {
expression: count_distinct ( ${orders.primary_key} ) = count( ${orders.primary_key} );;
}
}
Could someone tell me if this is written properly or if there is another way to do it? The error I get when I run the test says what you can see in the picture attached. Thanks for the help!
Solved! Go to Solution.
I used exact same test in one of my explores and it runs fine. Double check that your source explore is referenced correctly