Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

Adding averages

Hi,

The following expression is working for me in Qlik Sense, but I wonder if there's a way to write it shorter/cleaner:

Avg({<LinkId={'254930'}, DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60 +

Avg({<LinkId={'254950'}, DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60 +

Avg({<LinkId={'254920'}, DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60 +

Avg({<LinkId={'254970'}, DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60 +

Avg({<LinkId={'254990'}, DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60 +

Avg({<LinkId={'255040'}, DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60

I expected to be able to do something like:

Sum({<LinkId={'254930','254950','254920','254970','254990','255040'}>}Avg({<DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60)


That does not work. Any idea to simplify the expression?

Thanks,

Juan

1 Solution

Accepted Solutions
Highlighted

Hi Juan

Use Combination of Aggr & AVG

Sum({<LinkId={'254930','254950','254920','254970','254990','255040'}>}Aggr(Avg({<LinkId={'254930','254950','254920','254970','254990','255040'},DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60, LinkId))



Regards

Celambarasan

View solution in original post

2 Replies
Highlighted

Hi Juan

Use Combination of Aggr & AVG

Sum({<LinkId={'254930','254950','254920','254970','254990','255040'}>}Aggr(Avg({<LinkId={'254930','254950','254920','254970','254990','255040'},DayName-={'Sat','Sun'}, TimePeriodIdx={'>=24'}, TimePeriodIdx={'<40'}>}TravelTime)/ 60, LinkId))



Regards

Celambarasan

View solution in original post

Highlighted

That is cunning. 

Never before thought of using aggr within set analysis.