Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
madsgrathe
Partner - Creator
Partner - Creator

Help with if expression in chart

Hi guys,

New to qlikview and to the forums so bear over with me [:)]

I'm trying to get a graph to show a calculated value for a selected group of cells.

I have 3 columns in my data: UserID, LoginDays and Sales.

I want to find the average sales per user, but only for users with a certain amount of LoginDays.

I've tried with a simple "if" statement, but I can't get it to work... Anyone?

Here's what I've been trying:

if(LoginDays>5,sum(Sales)/count(distinct UserID),0)


1 Solution

Accepted Solutions
syed_muzammil
Partner - Creator II
Partner - Creator II

Hi,

Try using Set Analysis,

sum({<LoginDays={'>5'}>} Sales)/count({<LoginDays={'>5'}>} distinct UserID).

					
				
			
			
				
			
			
			
				

View solution in original post

3 Replies
Not applicable

Hi MadsGrathe

Just try this

Avg(field_name)

hope its useful.

Regards,

Sri

syed_muzammil
Partner - Creator II
Partner - Creator II

Hi,

Try using Set Analysis,

sum({<LoginDays={'>5'}>} Sales)/count({<LoginDays={'>5'}>} distinct UserID).

					
				
			
			
				
			
			
			
			
			
			
			
		
madsgrathe
Partner - Creator
Partner - Creator
Author

Thank you so much - worked like a charm 🙂

I had a feeling it had something to do with SetAnalysis...