I have dataset in Power BI which is displaying n/a in some fields. I have connected Power BI dataset with Power BI report builder and I need to handle n/a in report builder. So if the value is n/a I need to display n/a else I need to round off the value to 1 decimal places.
I have written an expression as follows:
=IIF(Fields!Year5.Value="n/a", Fields!Year5.Value, FormatNumber(Fields!Year5.Value,1))
For number value, I am able to round off the number just fine but the "n/a" part is not showing as "n/a" but showing "#Error" when the report is executed.
I'd guess it's having trouble with the equality condition due to a data type mismatch.
See if this works better:
=IIF(IsNumeric(Fields!Year5.Value), FormatNumber(Fields!Year5.Value,1), "n/a")
Related
I have crystal Formula is
"Weighted Average ({command.Udf_flot5}, {command.total_mkt_val})"
How can i convert this crystal to SSRS expression?
I'm trying to convert crystal to SSRS
I believe the Crystal Reports takes the first argument values and creates the weighted average over the second argument. Something like:
=SUM(Fields!Udf_flot5.Value * Fields!total_mkt_val.Value) / SUM(Fields!total_mkt_val.Value)
My report has multiple parameters where the data populated in the dropdown does not show proper data. My parameter is suppose to populate 3 values(Say A, B, All). My parameters are populating just the ALL value in the drop down.
I have checked the query in the HANA Studio and the query is absolutely fine and gives A, B and All in the output but the same wont work in SSRS.
SSRS Version: 2017
Data Source : SAP HANA
The parameter works absolutely fine in the dev environment but gives the above mentioned issues in other environment.
How can I get all the 3 values in the parameter drop down?
Use this in the expression in your Query parameter when you are dealing with multi value parameters:
join(Parameters!<your param name>.Value,",")
I am new-ish to SSRS (2012) coming from a loooong background using BusinessObjects, so it is sometimes hard for me to know how to search for the correct terminology.
I have a report like this, where the sections are in on tablix and the Grand Total in another.
This layout is required (or this would be a bit simpler!)
Section 1
Date 1 Date 2 Date 3 % of Grand Total
Product1 value value Value Value3/GT3 (12%)
Product2 value value Value Value3/GT3 (14%)
Section Total Total1 Total Total3 Value3/GT3 (7%)
Section 2
Date 1 Date 2 Date 3
Product1 value value Value Value3/GT3 (30%)
Product2 value value Value Value3/GT3 (22%)
Section Total Total1 Total 2 Total3 Value3/GT3 (22%)
Grand Total GT1 GT2 GT3 GT3/GT3 (100%)
I am having difficulty calculating % of Grand Total, as the numerator and denominator are not in the same scope.
I thought maybe a Report Variable, but I can't figure out how to create the equivalent of this kind of formula from BusinessObjects -
=Sum(Value) where (Date = "Date 3")
I want to assign the context or scope for my report variable but I don't know how to do that, or if it will even work.
I know I can create the scope of the whole report by including the Dataset name in quotes, but how to limit to a subset of that?
Thanks,
nod.
The aggregate functions in SSRS will take a scope as the second parameter. That scope parameter is a string that is the "name" of whatever your scope is. If you want the scope to be the table group you would use the name of your table group. If you want the scope to be your entire dataset then you would use the name of your dataset. You can always see the name of an element in the properties window (press F4).
Depending on how you've done your filtering you could use different scopes. Using the dataset name would be the most straightforward, but that assumes that the dataset has already been filtered to the correct records in the SQL. Otherwise you would probably want to use the tablix as your scope. (Something like "Tablix1" instead of "DataSetName" in the example below.)
Once you know which scope you're using you can use a conditional in the aggregate to only look at the correct records. E.g. to rewrite your Business Objects expression in SSRS you would do:
=SUM(IIF(Date = "Date 3",Value,0), "DataSetName")
This expression works because if the Date field does not equal "Date 3" it will return zero and not add anything to your SUM. Only rows where Date = "Date 3" will have their Value included in the SUM() function.
Some good resources on SSRS scope and aggregate functions:
MSDN: Expression Scope for Totals, Aggregates, and Built-in Collections (Report Builder and SSRS)
MSDN: Aggregate Function (Report Builder and SSRS)
The mike-d is a great explanation; I'd like to add just a special hint for the record: when you code that onto a report variable, watch out all the field types; my SSRS 2012 throws a generic "cannot generate the report" (*) when I use:
=Sum(IIf(Fields!ROWTYPE.Value = 9, Fields!TAXES.Value, 0), "DataSet1")
It's a stupid detail for which I lost eons: the TAXES field is decimal, the 0 is... integer! Simply substitute the latter with CDec(0)!
Ciao
(*) The real error is only in the ssrs system logs. Something like (freely translated sorry): "The expression for the variable myVAR uses an aggregation function on different data type"
I am trying to show one of the two simple reports on a click event. I have three report designs in a single Dynamics SSRS reporting project. One pie and two table designs. I want to show one of the table based on the user selection on pie slice. When I try to add conditional function for report action on the pie series I get compile time error stating that it is not allowed.
Action on series properties is set to "Go to report" and expression is set to ReportPrj.AutoDesign1 only this works, if I try to use a conditional query for my expression this fails to compile.
[=IIf(Parameters!pvalue.Value = 1, "ReportPrj.AutoDesign1", "ReportPrj.AutoDesign2")]
Matter of fact anything other than ReportPrj.Design format fails to compile. Is this some kind of limitation on AX SSRS reports. If that is the case what are my other options.
Here is the compile error.
ReportPrj.AutoDesign1Pie.: Could not resolve drillthrough target report =IIf(Parameters!pvalue.Value = 1,
"ReportPrj.AutoDesign1",
"ReportPrj.AutoDesign2"
).
I am running Dynamics AX 2012 CU2, SQL Server 2008 R2, and Visual Studio 2010 on a Windows 2008 Server.
All you help is greatly appreciated.
Thank you,
mm
Is that a valid expression with the starting "[" and ending "]"?
Does this work?
=IIf(Parameters!pvalue.Value = 1, "ReportPrj.AutoDesign1", "ReportPrj.AutoDesign2")
Is it possible to load a data region (matrix) only on request. I have a screen with a few fields and a 13 week revenue tablix that can take 10 or more seconds to load. I'd like the tablix data region to only load when the user needs to see that information. My understanding of how SSRS works is that this is not possible, but I'd like to confirm. Are there any workarounds?
Sql Server Reporting Services 2008 R2
You can set the visibility of the Matrix on the value of a paramater .
For example ,you can create a new paramter ShowParamter.
Lets say your Matrix's Id is matrix1, then under visibility set the hidden property of matrix1 as
IIF(Paramaters!ShowParamter="True", false,true)
If the value of the paramater is true then the matrix should be seen otherwise hidden.