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: 
padraig
Partner - Contributor II
Partner - Contributor II

KPI and chart are showing different averages

I have a KPI which calculates the average of a database column for the current year. I also have a line graph that shows the average for this column for each year. The issue is that the KPI is returning 9.5 whilst the line graph is showing 6.5.

I have vCurrentYear as a variable equal to today's year - this is working and equates to 2021.

The KPI measure:
avg(if(year(created_at)=vCurrentYear, total_no_of_visits))

The chart dimension:
year(created_at)

The chart measure:
avg(total_no_of_visits)

1 Reply
anat
Master
Master

can u try like if(year(created_at)=vCurrentYear, avg(total_no_of_visits))