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

If with count in KPI

Hello,

I need to display the count of customer id's w.r.t Fyear in KPI. If current Financial Year is selected , then  count of customer_id's should be count of all Financial Year, if previous year is selected then it should show count of customer_id's for that particluar year.

I tried to use if expression, but its not working. Please find the expression i used below,

=if(
fYear=$(vMaxYear),
(count({<fYear={"*"}>}distinct customer_id)),(Count(distinct customer_id))).

Our Fyear is considered from Apr till Mar. 

Please help to check. 

Thanks in advance.

 

1 Solution

Accepted Solutions
sunainapawar
Creator
Creator
Author

Hello All,

I have got the solution. I just used the below expression and it worked.

Count({<fYear={"<=$(vMaxYear)"},FYear>}distinct customer_id)

View solution in original post

5 Replies
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Try this

if(fYear=$(=vMaxYear),(count({<fYear=>}distinct customer_id)),(Count(distinct customer_id)))

Thanks

Thanks and Regards
Kashyap.R
sunainapawar
Creator
Creator
Author

Hi Kashyap,

Thanks for the reply. This is working upon selection of fyear 2019. It is showing count of customer_id for 2019. But when i select 2020 it is showing only for fyear 2020, but rather it should show count of customer id's for both 2019 and 2020. 

Please suggest.

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

Try this

if($(=max(fYear))=$(=max({<fyear=>}fyear)),(count({<fYear=>}distinct customer_id)),(Count(distinct customer_id)))

Hope this works

Thanks

Thanks and Regards
Kashyap.R
sunainapawar
Creator
Creator
Author

Hi Kashyap,

It is same as previous result.

For current year selection, its not summing up the count of 2019,2020. Its only showing for 2020.

 

sunainapawar
Creator
Creator
Author

Hello All,

I have got the solution. I just used the below expression and it worked.

Count({<fYear={"<=$(vMaxYear)"},FYear>}distinct customer_id)