Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
BonganiButh
Contributor III
Contributor III

Fill in blanks with the max value grouped by ID

BonganiButh_0-1611604640633.png

How do  i go about filling in all the missing values in 'Avg_Cost' with the known max value as seen in the above. 

I have tried the below but no luck.

 

LOAD [request id],
[order id],
line,
[customer ref],
repair_type,
Repair_class,
[order status],
[order stat],
[product id],
Product_Name,
Avg_Cost,
Repair_Age_in_Days,
warehouse_id,
station_id,
ID,
ID_1,
allocated_qty,
qty,
in_bound_qty,
out_bound_qty,
qty_at_repair_vendor,
qty_at_customer,
[assigned name],
[assigned to],
[action group name],
[action group id],
Bytes_Region,
IMO,
IMO_status_id,
IMO_status,
primary_IMO,
Primary_IMO_Status_id,
Primary_IMO_Status,
fr_warehouse_id,
to_warehouse_id,
fExceptions,
RESPONSIBILITY,
ACTION,
Operation,
ID2,
carrier_id,
carrier_ref_no,
Ageing_category,
AgeRank,
Owner,
Tracking_no;

[OpenRepairOrders]:
SELECT "request id",
"order id",
line,
"customer ref",
"repair_type",
"Repair_class",
"order status",
"order stat",
"product id",
"Product_Name",
"Avg_Cost",
"Repair_Age_in_Days",
"warehouse_id",
"station_id",
ID,
"ID_1",
"allocated_qty",
qty,
"in_bound_qty",
"out_bound_qty",
"qty_at_repair_vendor",
"qty_at_customer",
"assigned name",
"assigned to",
"action group name",
"action group id",
"Bytes_Region",
IMO,
"IMO_status_id",
"IMO_status",
"primary_IMO",
"Primary_IMO_Status_id",
"Primary_IMO_Status",
"fr_warehouse_id",
"to_warehouse_id",
fExceptions,
RESPONSIBILITY,
"ACTION",
Operation,
ID2,
"carrier_id",
"carrier_ref_no",
"Ageing_category",
AgeRank,
Owner,
"Tracking_no"
FROM AsteaMSBISDB.dbo.OpenRepairOrders;

LEFT JOIN (OpenRepairOrders)

[MaxCost]:
LOAD [order id],
if(len(trim(Avg_Cost))=null() and [product id]=peek([product id]), Peek(MaxFiled), Alt(Avg_Cost,0)) as MaxAvg,

[product id]
Resident [OpenRepairOrders];

1 Solution
2 Replies
BonganiButh
Contributor III
Contributor III
Author

Thanks @Ksrinivasan  This help me resolve the issue.