Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
AjjuSid
Contributor III
Contributor III

Set Analysis - Count the Active Dealers

Hi All, 

I am trying to get the count of active dealers in my report  and need help with the Set Analysis expression. Need to get the Count of Dealers having at least 1 contract produced since 2022.   

This way  I can eliminate the Inactive dealers who haven't produced a contract since last year. 

Fields = Contract ID (Fact Table), Dealer ID (Dim Table, associated with fact based on DEALER_ID), and Date(Fact Table).

I tried the below expression, but it didn't help me. 

count({<[Dealer ID] = {"=sum({<[ Date] = {'>=01/01/2022'}>}[Contract ID]) >0"} >} distinct [Dealer ID] )

Please let me know if you need further information. 

can the experts please help with the question. Thanks 
@sunny_talwar @swuehl @tresesco 

Qlik Sense Business 


Labels (2)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

A quick try; for search string try a valid quote other than single quote. Also sometimes date format could lead to the issue. Try like below and see if helps, if not we have to dive deep.

count({<[Dealer ID] = {"=sum({<[ Date] = {`>=MakeDate(2022)`}>}[Contract ID]) >0"} >} distinct [Dealer ID] )

 

Note : in red I am using backquote

View solution in original post

3 Replies
tresesco
MVP
MVP

A quick try; for search string try a valid quote other than single quote. Also sometimes date format could lead to the issue. Try like below and see if helps, if not we have to dive deep.

count({<[Dealer ID] = {"=sum({<[ Date] = {`>=MakeDate(2022)`}>}[Contract ID]) >0"} >} distinct [Dealer ID] )

 

Note : in red I am using backquote

BrunPierre
Partner - Master
Partner - Master

By using double quotes, it will be interpreted as a search value.

count({<[Dealer ID] = {"=sum({<[ Date] = {">=01/01/2022"}>}[Contract ID]) >0"} >} distinct [Dealer ID] )

AjjuSid
Contributor III
Contributor III
Author

Backquote did really help, but the issue was mainly because of the date format- I had to use 01/01/2022 instead of Makedate(2022). 

Thanks for your prompt reply, this really helped.