【问题标题】:Powerpivot Rankx with multiple filters具有多个过滤器的 Powerpivot Rankx
【发布时间】:2018-02-10 01:16:21
【问题描述】:

我想在基于三个简单条件过滤后为 [Site] 分配一个行号:它们是否具有相同的 [Year]、[Identifier] 以及 [LeftOrJoined] 列是否为“JOINED”。

所以我想要下面的 [Rank] 列:

[Year] | [Identifier] | [LeftOrJoined] | [Site] | [Rank]
2012      1             LEFT             A         
2012      1             JOINED           B         1
2012      1             JOINED           C         2
2013      2             LEFT             A
2013      2             JOINED           B         1
2013      2             JOINED           C         2

我的公式是:

Rankx(
    filter(table,
        allexcept(table,
                [LeftOrJoined]="JOINED",[Year]=[Year],
                [Identifier]=[Identifier])),
                    [Site], ,1,dense)

但我收到错误:ALLEXCEPT 函数需要参数“2”的表引用表达式,但使用了字符串或数字表达式。

我觉得我犯了一个基本错误。非常感谢任何帮助!

【问题讨论】:

    标签: dax powerpivot


    【解决方案1】:

    我不确定您的公式应该如何工作,但以下对我有用:

    Rank = IF(Table[LeftOrJoined] <> "JOINED", BLANK(),
              RANKX(FILTER(Table, Table[LeftOrJoined] = "JOINED"),
                    Table[Site], , 1, Dense))
    

    如果LeftOrJoined 不是“JOINED”,则返回空白,否则,将Site 排在LeftOrJoined 等于“JOINED”的行上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      • 2019-12-29
      • 1970-01-01
      相关资源
      最近更新 更多