在加载脚本中创建指标变量

Create indicator variable in load script

我加载以下输入table

通过这个脚本:

source_table:
Load company,
     product,
     sales
FROM source_file1.xlsx

我现在想在脚本中创建一个 table,如下所示:

列 highest_selling 是销售该特定产品最多的公司的指标。如何才能做到这一点? 任何帮助将不胜感激。

问候 丹尼尔

加载源后。

source_table:
Load company,
     product,
     sales
FROM source_file1.xlsx

然后找到最高的卖家。

Highest:
Load product,
     max(sales) as Highest
resident source_table group by product;

然后将最高指标连接回源 table

left join (source_table)
load product,
     Highest as sales,
     1 as highest_seller
resident Highest; drop table Highest;