Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ZimaBlue
Creator
Creator

The average instead of the sum on the linear chart

Hello!

I have a line graph with dates. I just want to display on my line chart the average value of the day, instead of the sum. This should happen very simply, however, there is no switch in the chart settings for the displayed results.

How can I implement this?

I tried the following, but nothing changes, it's still the sum:

avg(aggr( (sum(payments) / count(distinct user_id)) , signup_time))

Labels (3)
9 Replies
hic
Former Employee
Former Employee

Average per what? Since you use "Count(distinct user_id)", I guess the answer is "Average per User". Then you should use 

Sum(payments) / Count(distinct user_id)

ZimaBlue
Creator
Creator
Author

Hello! I need an average for the day. So I want to get a line graph in which I will see the cost dynamics of my measure by days (and I don't want it to be summed by the number of users, I just need an average value by 1 unit)

I use Sum(payments) / Count(distinct user_id) 

but the linear chart shows me the sum of the values obtained by this measure for the day, and I want to get only one value.

hic
Former Employee
Former Employee

You need to show what you mean. The expression calculates the average payments per user.

If "Sum(payments)" results in the same number as "Sum(payments) / Count(distinct user_id)", then you only have one user per dimensional value (signup_time). Perhaps you should use something else as dimension? E.g. Date.

ZimaBlue
Creator
Creator
Author

I use the date as a measurement and my measure as a measure. But it gives me the sum on the line graph. For example, if the measure = 100 and there were 10 registrations for 1.01.22, the chart will show me 1000 for 1.01.22, but I want to see 100 there.

I need the dynamics of the cost by day for 1 unit, I don't want to see the sum there

 

dimension = day(signup_time)

ZimaBlue_0-1646383427738.png

 

ZimaBlue
Creator
Creator
Author

so I need the average for the day, but when using aggr+ avg it still gives me the sum

ZimaBlue
Creator
Creator
Author

the formula I gave in the example is greatly simplified, the main question is: HOW to make the chart show the average by 1 unit, and not the sum of the measure values for that day

hic
Former Employee
Former Employee

Do you have more than one month of data? If so, you shouldn't use Day() as dimension. For example, Day()=1 will show all data for the first of the month, but it will be for ALL months - Jan, Feb, Mar, etc.

ZimaBlue
Creator
Creator
Author

Unfortunately, even if I create a completely new application and upload there only one month and only one measurement with a date, qlik sense still shows only the sum of measure values in the line chart, it cannot show me just the average value...

hic
Former Employee
Former Employee

I can assure you that the Qlik engine calculates the average if you have used Sum() / Count(). But since you don't get the numbers you expect, something else must be wrong.

I would start debugging by looking at a small dataset - just a few days - and use a bar chart or a table with 

  • Dimension: Date(Floor(signup_time))
  • Measure1: Sum(payments) 
  • Measure2: Count(distinct user_id)
  • Measure3: Sum(payments) / Count(distinct user_id)

... just to better understand what happens.