简体   繁体   中英

SSRS Report Parameter causing problems

I am facing a weird problem with SSRS Report Parameters . Currently working on SSRS 2016 version. We Connect to SSAS Models and create Data_sets using DAX Queries in the Report.

Here is the sample DAX Query used in my report Dataset,

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 '.

The problem I am facing is that, this query works well if I remove the 2nd Parameter "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. 在此输入图像描述 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. 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,

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!!

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

  1. Create Main dataset1 (all requried fields including city column)
  2. Create Dataset2 for parameter for example (get only city column in this dataset)
  3. Create parameter using the Dataset2 then go to main dataset1 - properties - filter. - add column and parameter in the expression. this will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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