简体   繁体   English

SSRS报告参数导致问题

[英]SSRS Report Parameter causing problems

I am facing a weird problem with SSRS Report Parameters . 我面临着SSRS报告参数的怪异问题。 Currently working on SSRS 2016 version. 当前正在使用SSRS 2016版本。 We Connect to SSAS Models and create Data_sets using DAX Queries in the Report. 我们连接到SSAS模型,并使用报告中的DAX查询创建数据集。

Here is the sample DAX Query used in my report Dataset, 这是我的报表数据集中使用的示例DAX查询,

evaluate
summarize(
calculatetable(
('Field Measures',
  PATHCONTAINS(substitute( 
  substitute( 
  substitute( 
  @Parameter_District
  , "{ ", "") 
  , " }", "") 
  , ",", "|") , 'Field Location'[District]),
  PATHCONTAINS(substitute( 
  substitute( 
  substitute( 
  @Parameter_City
  , "{ ", "") 
  , " }", "") 
  , ",", "|") , 'Field Location'[City])
  )
  'Field Fact'[Field Interview Number],
  'Occurred Date'[Date],
  'Occurred Date'[Year]
 ))

I have two parameters ( District and City ) defined in this query and both the fields are coming from the same table ' Filed Location '. 我在此查询中定义了两个参数( District和City ),并且两个字段都来自同一个表“ Filed Location ”。

The problem I am facing is that, this query works well if I remove the 2nd Parameter "CITY" . 我面临的问题是,如果删除第二个参数“ CITY” ,则此查询效果很好。 But it fails when I include this in the query. 但是,当我在查询中包括它时,它将失败。 for simplicity I have mentioned only 2 parameters here, but I have around 5 parameters coming from the same table which were working fine. 为了简单起见,我在这里只提到了2个参数,但是我有大约5个参数来自同一张表,它们工作正常。 在此输入图像描述 I am banging my head why this happens only when I include [CITY] Object in the parameter list and why it works good when I remove this. 我很想知道为什么只有当我在参数列表中包含[CITY]对象时才会发生这种情况,以及为什么在删除它时它会很好地起作用。 Literally I am out of my mind :( 从字面上看,我不在意:(

Please suggest me some way to debug this issue. 请建议我一些调试此问题的方法。

Thanks a bunch. 谢谢一堆。 Balaji 巴拉吉

I got the solution for my issue, but I don't have a logical reason why it works. 我为我的问题找到了解决方案,但是我不知道它为什么起作用。

Let me re-post the DAX Query that I was using in my report, 让我重新发布报表中使用的DAX查询,

evaluate
summarize(
calculatetable(
('Field Measures',
  PATHCONTAINS(substitute( 
  substitute( 
  substitute( 
  @Parameter_District
  , "{ ", "") 
  , " }", "") 
  , ",", "|") , 'Field Location'[District]),
  PATHCONTAINS(substitute( 
  substitute( 
  substitute( 
  @Parameter_City
  , "{ ", "") 
  , " }", "") 
  , ",", "|") , 'Field Location'[City])
  )
 'Field Fact'[Field Interview Number],
 'Occurred Date'[Date],
 'Occurred Date'[Year],
 "Field Count",[FieldInterview - Count]
  ))

If we observe the original code I post earlier and the one I posted now, there is one line difference between them. 如果我们观察到我之前发布的原始代码与现在发布的原始代码,则它们之间存在一行差异。 ie The Measure Value ( Field Count ). 测量值( 字段计数 )。 while formatting my question I removed this last line of code (by mistake).But then when I revisited my own question for any probable answers, I noticed this difference and I just tried to use the query by removing the above mentioned Measure value and it just worked like magic!! 在格式化我的问题时,我删除了最后一行代码(错误地)。但是当我重新访问自己的问题以寻找任何可能的答案时,我注意到了这种差异,我只是尝试通过删除上述Measure值来使用查询就像魔术一样工作!!

So, I really did not understand how Measures, Joins and Parameters work internally. 因此,我真的不了解度量,联接和参数在内部如何工作。 I am still open for any kind of discussion/inputs from experts here. 我仍然愿意接受这里专家的任何讨论/投入。

Thank you. 谢谢。 Balaji 巴拉吉

Simple way , Instead of creating parameter using DAX , go for Filter 简单的方法,而不是使用DAX创建参数,而是使用Filter

  1. Create Main dataset1 (all requried fields including city column) 创建主数据集1(所有必填字段,包括城市列)
  2. Create Dataset2 for parameter for example (get only city column in this dataset) 例如,为参数创建Dataset2(仅在此数据集中获取城市列)
  3. Create parameter using the Dataset2 then go to main dataset1 - properties - filter. 使用数据集2创建参数,然后转到主数据集1-属性-过滤器。 - add column and parameter in the expression. -在表达式中添加列和参数。 this will work 这会奏效

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

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