使用具有多个值的查找表的动态DAX安全筛选器

时间:2016-06-22 18:34:16

标签: ssas dax tabular ssas-tabular

我将动态安全性应用于教育环境中的SQL Server表格模型。我有一个安全表,其中包含用户ID和用户应该有权访问的相关学校。如果用户有一所学校,我的DAX过滤器可以正常工作,但是对于拥有多个学校的用户,我得到了一个多值错误(“提供了多个值的表,其中包含一个值。”)。我的Enrollment[SchoolKey]函数导致了问题,我基本上试图确定如何创建循环以将SecurityTable[SchoolKey]与每个用户的每个= CONTAINS ( 'Enrollment', 'Enrollment'[StudentKey], Student[StudentKey], 'Enrollment'[SchoolKey], LOOKUPVALUE ( SecurityTable[SchoolKey], SecurityTable[UserId], USERNAME () ) ) 值进行比较。任何想法都非常感谢!

import SpriteKit

class EndScene : SKScene {
    var viewController : UIViewController?
    override func didMoveToView(view: SKView) {
        self.segue()

    }
    func segue() {
        self.viewController?.performSegueWithIdentifier("gameToMain", sender: viewController)
    }
}

1 个答案:

答案 0 :(得分:0)

我知道这个答案很晚,但你可以在注册表上试试这个DAX过滤器:

='Enrollment'[SchoolKey]
    = LOOKUPVALUE (
        SecurityTable[SchoolKey],
        SecurityTable[UserId], USERNAME(),
        SecurityTable[SchoolKey], 'Enrollment'[SchoolKey]
    )

此处,LOOKUPVALUE中的第一个搜索条件会导致用户有权访问的所有行(学校),而第二个搜索条件会进一步将结果集缩减为单行。

您可以在https://msdn.microsoft.com/en-us/library/hh479759.aspx

参考MSDN中的详细示例