Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
neerajthakur
Creator III
Creator III

YTD LYTD Set Analysis to find no. of Customers in KPI Measures

YTD Variable Expression: ">=$(mindate)<=$(maxdate)"

LYTD Variable Expression: ">=$(lmindate)<=$(lmaxdate)"

lmaxdate -> =num(AddYears(MAX(DateKey),-1))

lmindate -> =num(AddYears(YearStart(max(DateKey)),-1))

I want to find Count(Customers) for YTD and LYTD in KPI.

How can I achieve the results with my above variables in place.

I have used this for No. of Customers in YTD =Count({<DateKey={$(=ytd)}>} Distinct [Customer]) and for LYTD =Count({<DateKey={$(=lytd)}>} Distinct [Customer])

I am not getting desired results. 

Thanks & Regards,
Please Accepts as Solution if it solves your query.
1 Reply
rubenmarin

Hi, ahve you tried without the equal sign after $(?:

=Count({<DateKey={$(ytd)}>} Distinct [Customer]).

In expression editor you can chek how the values are expanded, you can try $(mindate) to check the value it returns, doing the same with all other $( expressions to confirm they wirk as expected.

Also do a fully manual expression, converting $-expression to manually written values to make the expression work. With a working expression convert the $-expression into some some expression that returns the desired vales, in the format you need.

Maybe a date is returned with decimals or in an unexpected date format.