How can I compare the distinctcountover function result value with a parameter

Basically, I am writing ifelse(distinctCountOver(listingId,[AgentName],PRE_AGG)<1Parameter_Value,AgentName,NULL) but it shows error. It can easily compare with the constant number but not working with the parameter value. Please help me in any way possible.

Hi @graphs
what is the error msg telling?

@graphs I am able to get a similar formula working on my data.
ifelse(distinctCountOver({order id},[customer],PRE_AGG)<${threshold} ,{customer},NULL)

Are you using the right syntax for your parameter (using the ‘$’ before the name)? Also make sure your parameter is a Single Value parameter and not Multiple Values. Be sure toe check the data type of your parameter too (needs to be Integer or Number, not String).

Yes this is working. But there is an error when I use the parameter value in calculated field with > comparison, it is working fine. But in the case of less than it is showing no results

I can get the calc to work using either > or <. Is the calculation editor actually throwing an error or you are not seeing any data in the visual? If the latter then maybe we need to fix the logic in the calc, or some of your filters are causing no data to show.

Hello @graphs, are you able to follow-up with more information about the problem you are facing related to the questions above so we can help guide you towards a solution?

Yes, I got the solution. Its working Fine. What Jesse shared is working. Thanks.

1 Like