How can I write expression to take an subtraction of two fields in ssrs? - sql

I'm working on SSRS report.
There are two main fields CurrentMV and PreviousMV.
field CurrentMV having expression =Sum(Fields!CurrentMV.Value)
field PreviousMV having expression =Previous(Sum(Fields!CurrentMV.Value))
I'm having another field on report MTM which is nothing but difference between
CurrentMV- PreviousMV How can I write expression for MTM as there is already expression used in CurrentMV and PreviousMV
please help me.

=Sum(Fields!CurrentMV.Value) - Previous(Sum(Fields!CurrentMV.Value))?

=Sum(Fields!CurrentMV.Value)-Previous(Sum(Fields!CurrentMV.Value)) ? or am I missing something obvious?

Related

Rdlc report expression not formatted correctly. What am i doing wrong?

What is wrong with this tablix group expression?
=First(Fields!ROWNO.Value, "QuestionPaperData")
During edit, I am not allowed to share image. I could not read the full message. I am still struggling for exact design.
Try to make the expression like this =Fields!ROWNO.Value

Nesting Expressions

I have and expression:
=UCASE(Fields!MotherFullName.Value)​
and an expression:
=IIF(ISNOTHING(Fields!MotherFullName.Value) ,"-",Fields!MotherFullName.Value)
I want to nest them into one expression since they are operating on the same value, what must I do?
Using your code and taking a pass on evaluating the syntax...
=IIF(ISNOTHING(Fields!MotherFullName.Value) ,"-",UCASE(Fields!MotherFullName.Value)​)
What have you tried?
=IIF(ISNOTHING(UCASE(Fields!MotherFullName.Value)​) ,"-",UCASE(Fields!MotherFullName.Value))
should work, but I'd Advise you to Create Additional fields in your report and they use them to arrive at what you need, since the fields you dont include will not be displayed.
Also, Make sure you are making your edits in the expression window, not directly on your reports.
I finished creating the report above and it is working well, but when I upload it into the CRM Dynamics online, it is greyed out as shown in the picture bellow: What must I do?

How do I add a wildcard option as an available option for a SSRS paramater?

I'm trying to add in a wild card selection to my one of my dropdowns within a SSRS report that passes in a "%" to the query it is linked to but has a label of "All Vendors" to the end user.
Highlighted is where I would like to see "All Vendors"
I attempted to use the available values option as opposed to the get values from a query option with the idea that I could specify an expression that returns the same values as the query and then specify a single value as described above. But when I tried to do this I received an error like:
"A value expression used for the report parameter "VND" refers to a field. Fields cannot be used in report expressions."
The expression I used was:
=Multilookup(Split(Fields!ve_name.Value, ",")
Available Values Window
Could someone tell me if theres an easier way to accomplish this or if my syntax is just bad and that this is the best way to do this?
As alejandro zuleta, mentions in a comment,
Why don't you just use a multiple valued parameter? Multiple valued parameter include a Select All option. Check this
Using a multiple valued parameter helped.

How to implement 'Not In' Filter in SSRS?

I have a field in SSRS that i need to filter on.
For 3 table I can use a IN filter.
But I am in need to use a NOT IN operator. The field contains numeric values.
I need to be able to say not in (30,31,32,33,34,35,36,37,38,39)
I cant do it within the dataset either, needs to be a filter.
How should I achieve it ?
You can use an expression to determine which values are going to be filtered.
Go to Tablix properties/ Filters
In expression use:
=IIF(Array.IndexOf(split("30,31,32,33,34,35,36,37,38,39",","),
CStr(Fields!YourField.Value))>-1,"Exclude","Include")
For Operator use:
=
For Value use:
="Include"
Let me know if this can help you
For a variation of the selected answer that I find easier to use, please see below. This is in a Visibility expression, but should be easily ported to a Filter expression by setting Expression type to Boolean and comparing if Expression = True:
=IIf(InStr("unwanted values here", Fields!fieldToCheck.Value), True, False)
Firstly I would like to say that, to my knowledge, NOT IN is not available in list of operators for filters.
To Achieve the same thing in other way, please refer the following link..it might help you...
http://blog.datainspirations.com/2011/01/20/working-with-reporting-services-filters-part-4-creating-a-not-in-filter/

how to make different types of report in one sql statement?

I need to make a query that makes a report using different tables, based on a value of one field.
This value affects the 'select' as well as the 'from' and 'where'.
At first I thought using dynamic SQL, but since the 'from' and 'where' are also changing it won't work.
Now I'm thinking about making views for all the different report types and I have 2 questions about is, since I'm pretty new with this:
how do I use the views in the main query?
is there a better idea that could work for the problem?
Thanks in advance
how do I use the views in the main query?
Just like every table.
is there a better idea that could work for the problem?
I don't know if it's better but you can use UNION (if number of columns in every report is equal and their types are the same).