创建具有递归行计算的DAX表

时间:2019-04-04 08:40:56

标签: dax

我想创建一个像这样的表

trends = ['Bill','Visits', 'Avg. Visits','abc',
          'mcd', 'mckfd', 'mfd', 'aps', 'mvmv', 'dep']

df_new = df.loc[df.index.repeat(len(trends))].assign(trend_type=trends * len(df))
print(df_new)

   id          email   trend_type
0   1    abc@xyz.com         Bill
0   1    abc@xyz.com       Visits
0   1    abc@xyz.com  Avg. Visits
0   1    abc@xyz.com          abc
0   1    abc@xyz.com          mcd
0   1    abc@xyz.com        mckfd
0   1    abc@xyz.com          mfd
0   1    abc@xyz.com          aps
0   1    abc@xyz.com         mvmv
0   1    abc@xyz.com          dep
1   2  cdsm@kcmd.com         Bill
1   2  cdsm@kcmd.com       Visits
1   2  cdsm@kcmd.com  Avg. Visits
1   2  cdsm@kcmd.com          abc
1   2  cdsm@kcmd.com          mcd
1   2  cdsm@kcmd.com        mckfd
1   2  cdsm@kcmd.com          mfd
1   2  cdsm@kcmd.com          aps
1   2  cdsm@kcmd.com         mvmv
1   2  cdsm@kcmd.com          dep

我找不到定义在DAX Table中使用的变量的方法。有什么建议吗?

0 个答案:

没有答案