简体   繁体   English

在DAX,ssrs中作为输入参数列出

[英]List as input parameter in DAX, ssrs

In an other Stack Overflow question I got the following code, to extract the right dataset depending on the input parameters in an SSRS report, using a DAX query. 在另一个Stack Overflow问题中,我得到了以下代码,使用DAX查询根据SSRS报告中的输入参数提取正确的数据集。

    EVALUATE
(
    CALCULATETABLE
    (
        ADDCOLUMNS (  
            'Case',
            "Casenumber", RELATED( 'Casedetails'[Casenumber]),
            "Casetitle", RELATED('Casedetails'[Casetitle]),
            "Date", RELATED ( 'Casedates'[Shortdate]),
            "Caselink", RELATED ( 'Casedetails'[Caselink]),
            "Place", RELATED('Geography'[Place])
            ),
//insert filters here
        'Casedates'[Shortdate] = @Date,
        'Geography'[Place] = @Place
    )
)

However, the user should and could be able to select all places (@Place). 但是,用户应该并且可以选择所有位置(@Place)。 Doing this with the current code gives the following error: 使用当前代码执行此操作会产生以下错误:

Cannot convert value '{20030, 20377, 20361..' of type Text to type Number.

So, the parameter essentially is a list of numbers. 因此,该参数本质上是一个数字列表。 As I have found, DAX have no "IN" operator, so how can I handle this case? 如我所见,DAX没有“ IN”运算符,那么如何处理这种情况?

This is a bit more tricky to do, and it's not something ive tried to do yet. 这有点棘手,而且我还没有尝试做。 However a quick google search brings up some decent results. 但是,快速的Google搜索会带来一些不错的结果。 This particular blog write up by Chris Webb is quite comprehensive and helpful. 克里斯·韦伯(Chris Webb)撰写的这个特别的博客非常全面和有用。 You will need to adapt your DAX expression to use the pathcontains DAX function and you will also need to change your SSRS parameter to a multi parameter and do some string manipulation. 您将需要调整DAX表达式以使用pathcontains DAX函数,还需要将SSRS参数更改为多参数并进行一些字符串操作。 See here http://blog.crossjoin.co.uk/2012/06/01/handling-ssrs-multi-valued-parameters-in-dax-queries/ 看到这里http://blog.crossjoin.co.uk/2012/06/01/handling-ssrs-multi-valued-parameters-in-dax-queries/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM