Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I already read this article A Myth About Count(distinct …)
As far as I understand we may use count distinct in script.
But can we use count distinct in expressions?
Should I first make count in script and then do sum in expression?
What is the best method of that?
Thanks.
You can do Count(DISTINCT Measure) in an expression... why do you want to do this in the script?
Hi Sunny,
Thanks for reply.
For example you may find info from the attached doc where says
"Count ( Distinct 'Field Name') Replace the count() with sum() and the distinct qualifier by assigning the value '1' to each distinct occurrence as it is read in the script"
I saw such examples on other sources too.
Should I do in script
1 as flag
and then calculate Sum(flag) in expressions?
May be one more read of the blog A Myth About Count(distinct …) would help you understand it better. The attached pdf documentation is outdated. You might not have to use a flag and you can directly use Count(Distinct ..) in expression.