Execute a Dataset based on parameter value -SSRS - sql

I have an SSRS report which have two datasets. One Dataset for showing the Amount of purchase in detail level for All Region Managers & other dataset is for displaying amount of purchase for individual manager. If the user select all managers as input, the report displays data from both datasets. If the user select a single manager, Detail level information will be hidden and data for that manager alone will be displayed ( Handled this by creating visibility expression in dataset). But whenever the report exectuted stored prcoedures for both datasets called. Is it possible to configure the execution of report dataset based on parameter values?
for e.g : In dataset1 properites I gave below expression,
=iif(Parameters!ManagerID.Value= -1,exec procedure1 ,0)
But it gave me error. How to make a dataset execute based on a parameter value?

Use an 'if' condition in both data sets. For example:
if #parameter = 'A'
...query....
else
select 1
And for the tablix, use visibility expression to hide based on the parameter va.

Related

Adding independent parameter to ssrs report

I am working on a SSRS report and i need to add a parameter for 'Invoice Number' search.
I already have start,end also type,program,frequency parameters. And those parameters are cascading so in order to select different 'type' first i need to specify frequency> program>type but my new filter should be independent from others.
SSRS report currently using sql store prod. and that store prod has two conditional store prod in it. I added my new filter into sub store prod. but it is still doesn't let me pick invoice number unless i specify other parameters. now if i select a value from type dropdown filter. for some values ssrs throwing me an error which says 'Prod or func ..... has too many arguments'
Any one has some ideas please?enter image description here

I am trying to display a view to see multiple units of measure for a set of data I have in SSRS

I have to generate a report from a SQL query.
The report contains trade data in a certain unit of measure, the users want to be able to see the data in three different units of measure.
Is there a way of adding a parameter where you can to pick a unit of measure and then it will convert the data into that specified unit of measure and not filter for the unit of measure?
For example I have the following trade detail
ID = 1
Amount = 100 MWH
I want to be able to change the parameters to allow me to see that amount in THERMS and KWH, I have the conversion factors it's just being able to choose between the three is the difficult part .
Use a float parameter.
On the label enter the unit names and on the values set the modifiers based on the main unit.
The main unit will have modifier = 1
Your value expression will be like =Parameters!UnitModifier.Value * Fields!val.Value

Add row number/rank to ssas tabular model

I'm trying to add row numbers (by some sorting column) or at least ranks into a calculated table inside azure analysis services tabular model (I need this rank column to use in TOPNSKIP, it should be precalculated column in the model's table. Really it will not be precalculated column for one sorting column only. It will be some expression I want to have precalculated). I used some thoughts from here DAX - Get current row number
I use Visual Studio with Microsoft Analysis Services Projects extension to deploy the model to ssas and SSMS to debug the requests. But it seems there are differences between dax requests in the SSMS and in the tabular models definitions.
The SSMS uses evaluate syntaxis and the tabular constructor = VAR RETURN. And it seems some functions are not available for the tabular models. It seems like ADDCOLUMNS and RANKX are not available for tabular models. Also , is used as operand separator in the SSMS and ; in the model DAX editor, (possible due to some internationalization options on my computer) and that is not very convenient. I could not find a way to get error report for the bad DAX request for the model definition. I only see for incorrect request that has been retrieved 0 records while I deploy a model and if I try to do some request to a table after deploying I get error message that it's empty because of incorrect construction, but no details. There is also a possibility to use calculated columns during the table construction, but I could not embed the RANKX function to the formula for them. Also I don't know how to use a MEASURE inside a construction function. The filter approach from the mentioned stackoverflow question was very slow on my amount of data. I was waiting about half an hour and stopped the deploying.
Because I don't see the ADDCOLUMNS works I've tried GENERATE and SELECTCOLUMNS. For example:
=
VAR NewTable = GENERATE(BaseTable; ROW("RowNumber"; RANKX(BaseTable; BaseTable[SortName];;1)))
RETURN NewTable
It works nice in the SSMS but can't be used to construct a table. While:
=
VAR NewTable = GENERATE(BaseTable; ROW("RowNumber"; 50))
RETURN NewTable
works fine everywhere. So I think RANKX is not working in the tabular model definitions.
Is there any way to rank or number rows in ssas calculated table by some sorting column?
Adding high cardinality columns such as an index number column is generally not advisable for tables in a tabular model, since these columns compress very very badly, thereby reducing query performance. Especially if the table is large. But if you must do it, use the technique shown here. If you don't want to add a calculated column to an existing table, you can wrap everything in a call to ADDCOLUMNS:
=
ADDCOLUMNS(
BaseTable,
VAR CurrentSortName = BaseTable[SortName]
RETURN
COUNTROWS(
FILTER(BaseTable, BaseTable[SortName] < CurrentSortName)
) + 1
)

Need to Display records Group By in SSRS

In SSRS 2008, I am developing the report that should display the records based on condition: It should give me the amt_total based on gift_type (Here, amt_total and gift_type are columns of the table).
This is the query I am using.
SELECT o110113.gift_batch_no,
o110113.gift_type,
(o110113.gift_date),
o110113.feed_doc_code,
SUM (o110113.amt_total)
FROM GIFT_CARD o110113
WHERE (o110113.gift_type IN
('RR', 'RB', 'CR', 'RM', 'RW', 'CW', 'RJ', 'RO', 'RK', 'CI')
)
GROUP BY o110113.gift_batch_no,
o110113.gift_type,
(o110113.gift_date),
o110113.feed_doc_code
ORDER BY o110113.gift_batch_no ASC, o110113.gift_type ASC
And the report I am trying to generate in SSRS 2008 should look like this.
Clikck this to see the Image of the Report that I am trying to develop
I am trying to use the SSRS expression
=Sum(Fields!SUM_O110113_AMT_TOTAL_.Value,"GIFT_TYPE")
It is throwing me the error saying:
Please click this to see an Error I am getting in SSRS
Kindly provide the Solution
This the report design I have developed
[click to see the Image of report]
Thanks
Arun
Here you need to do group by of your Tablix.
First you need to add Row group on gift_batch_no so that will dispaly based on gift batches.
Another row group your have to create on Gift type and in that second group type you need to set SUM of total amount it will work.
Let me know if you have any other query
That error has to do with the scope of your sum. without seeing the data sets and assuming it is not a nested aggregate operation based on the image. you are trying to reference the column name "GIFT_TYPE" when it should actually be the name of the record set, or the appropriate scope(data region/group).
here is how scope works from the provided link below
The value of scope must be a string constant andcannot be an
expression. For outer aggregates or aggregates that do not specify
other aggregates, scope must refer to the current scope or a
containing scope. For aggregates of aggregates, nested aggregates can
specify a child scope.
you will want to see this link for more information

Adding limit parameters to bar charts in Pentaho Report Designer

I am using Pentaho Report Designer to generate reports from my olap cube using mdx. I want to generate bar chart reports from Pentaho Report Designer. I have 50000 records and writing a MDX query to display keywords along with their count. Problem is bar chart that is created is of 50000 records, but I want to pass two parameters that act as start and end value to display i.e user is prompted to enter starting and ending parameters (suppose he enters 1 and 10) so 10 records should be displayed.
I do not know the specifics of Pentaho MDX, but in general, I would use the following approach, assuming the 50000 records are in hierarchy [DimA].[Record]:
WITH SET [Selected Records] AS
SubSet([DimA].[Record].[Record].Members,
ParamRef('start') - 1,
ParamRef('end') - ParamRef('start') + 1
)
SELECT { [Measures].[Count] }
ON COLUMNS,
[Selected Records]
ON ROWS
FROM [MyCube]
I am a bit guessing about the use of ParamRef in Mondrian MDX here. The SubSet function is described for Analysis Services here: http://msdn.microsoft.com/en-us/library/ms144767.aspx