Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Tarek2020
Contributor
Contributor

Qlik Sene Avg for null values

Hi evryone,

can someone help me please with thi issue?

 

I have a  table with 5 fields. the calculation should be for the null distance values:

If( isnull(distance), calculate the avg of distance where Consignee Zip , Consignor Zip, Consignee Zip Code, Consignor Zip code is the same.

for example in the second row should be the avg of 67 and 12 means 39,5.

Shipment noConsignee Zip Consignor Zip Consignee Zip CodeConsignor Zip codeDistance
144233467
24423340
344233412
45566400
555660
655660
755660
Labels (4)
3 Replies
sonkumamon
Creator
Creator

I would do it on the script level, for instance:

TempTable:

Load

[Shipment no],

[Consignee Zip],

[Consignor Zip],

[Consignee Zip Code],

[Consignor Zip code]

From...

Where Distance=0;

Left Join

Load

[Consignee Zip],

[Consignor Zip],

[Consignee Zip Code],

[Consignor Zip code],

Distance

From...;

 

Table:

[Shipment no],

Avg(Distance) as Distance

Resident TempTable

Group By [Shipment no];

 

And you will get the average of the distance where the other columns are similar for Shipment No with distance of 0.

Tarek2020
Contributor
Contributor
Author

Hi Sonkumamon,

thank you for your message. Unfortunately it does not working. I am searching for a logic for the frontend.

sonkumamon
Creator
Creator

It is very difficult to achieve in the frontend, and would have a negative impact on the performance. What is not working as expected in my solution?