Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
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

Re: Adding averages

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

Re: Adding averages

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

Re: Adding averages

That is cunning. 

Never before thought of using aggr within set analysis.