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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count distinct failing when reading a QVD

Hi, trying to count the distinct days in a months for a position.

when I run this:

CallDays:

LOAD

  [$CRM Position ID],

  MonthStart([CRM Call Date]) as MonthStartDate,

  count(DISTINCT[CRM Call Date]) as UniqueCallDays

  FROM ..\2_BAS_QVD\CRMActual.qvd(QVD)

  group by  [$CRM Position ID]

  ,MonthStart([CRM Call Date])

  ;

it errors:

Error in expression:

')' expected

CallDays:

LOAD

  [$CRM Position ID],

  MonthStart([CRM Call Date]) as MonthStartDate,

  count(DISTINCT[CRM Call Date]) as UniqueCallDays

  FROM ..\2_BAS_QVD\CRMActual.qvd(QVD)

  group by  [$CRM Position ID]

  ,MonthStart([CRM Call Date])

When I remove the DISTINCT, it runs fine (but obviously gives me too high a number of UniqueCallDays)

any idea why the error?

thanks!

1 Solution

Accepted Solutions
sunny_talwar

What if you add a space between DISTINCT and [CRM Call Date]

CallDays:

LOAD [$CRM Position ID],

          MonthStart([CRM Call Date]) as MonthStartDate,

          Count(DISTINCT [CRM Call Date]) as UniqueCallDays

FROM ..\2_BAS_QVD\CRMActual.qvd(QVD)

Group By [$CRM Position ID], MonthStart([CRM Call Date]);

View solution in original post

2 Replies
sunny_talwar

What if you add a space between DISTINCT and [CRM Call Date]

CallDays:

LOAD [$CRM Position ID],

          MonthStart([CRM Call Date]) as MonthStartDate,

          Count(DISTINCT [CRM Call Date]) as UniqueCallDays

FROM ..\2_BAS_QVD\CRMActual.qvd(QVD)

Group By [$CRM Position ID], MonthStart([CRM Call Date]);

Not applicable
Author

Oh my!  that was it. Thanks Sunny!