带过滤器的动力枢轴CONCATENATEX功能

时间:2018-02-13 15:15:54

标签: excel dax powerpivot

在PowerPivot中,我想查找[Year]后面每行的所有[Site]值,查找唯一的[ID]和[Joined]标签,上面写着" JOINED"。一个简单的查找!但是,某些行具有下一个[Year]的多个[Site]值。我想生成以下[Destination]列:

[ID]    [Year]    [Site]    [Joined]    [Destination]
A       2012      London                London, LA
A       2013      London    JOINED
A       2013      LA        JOINED
B       2012      Paris                 Berlin, Madrid
B       2012      Paris                 Berlin, Madrid
B       2013      Berlin    JOINED
B       2013      Madrid    JOINED

我现在的公式是:

=concatenatex(
          filter(
                 Table,[Year]=([Year]+1)&&[ID]=earlier([ID])&&[Joined]="JOINED"),
                 Table[Site],
                 ",")

然而,这不起作用。我的公式可能是错的。有没有办法做到这一点?任何帮助非常感谢!

1 个答案:

答案 0 :(得分:1)

你非常接近。您还需要在EARLIER上添加Year包装:

Destination = 
    CONCATENATEX(
        FILTER(Table,
               [Year] = EARLIER([Year]) + 1 &&
               [ID] = EARLIER([ID]) &&
               [Joined] = "JOINED"),
        Table[Site], ", ")