How to define Row Data group in SSRS if we have two parameters to be considered? - reporting-services

Im new to SSRS reporting. Im trying to edit in *.rdl file, where it has row data grouping to view data for a month.
eg: =Fields!EndOfMonth.Value
Here EndofMonth will return September 30th /October 31st etc. So table is grouped by one month data.
I need to edit this for a custom data range.
eg: startdate='2019-09-05', enddate='2019-10-12'
So, report table should display rows between September 5th to October 12th.
I have both startdate enddate parameters defined in the *.rdl file.
But I dont know, how i can switch between both date ranges based on condition. that is , if companyid<>50 pick custom range else standard.
eg:
I defined like this, but here i could point only one parameter(i used enddate only).So report shows rows between October 1st to 12th only.
How can I modify the condition?
=IIF(Parameters!CompanyId.Value<>50,Fields!EndofMonth.Value, Parameters!EndDate.Value)
EDIT
I have 2 datasets defined to switch between companyids.
I modified above condition based on Nicks answer, but i get lookup function can not be used with functions issue.
I tried following both way, but getting same rows again and again
=IIF(Parameters!CompanyId.Value<>50,Fields!EndofMonth.Value,
IIF(Lookup(Fields!TankDateCombo.Value, Fields!TankDateCombo.Value,Fields!Date.Value,"Dataset2")
>= Parameters!StartDate.Value,Fields!EndofMonth.Value,
Parameters!EndDate.Value))
=IIF(Parameters!CompanyId.Value<>67,Fields!EOM.Value,
IIF(Day(Lookup(Fields!TankDateCombo.Value, Fields!TankDateCombo.Value,Fields!Date.Value,"OESNeoData"))
>= Day(Parameters!StartDate.Value), Fields!EOM.Value,
Parameters!EndDate.Value))
MY dataset contains following data;

I fixed this by simply deleting that row group and passing start/end dates for both datasets

Related

SSRS How to get the value before the latest column of a matrix row group?

I would like to retrieve the value before the last column in the matrix.
The column are grouped by Month and user can choose in the report one , two, three or more columns , the aim is to get the before last column value.
For getting the last value I just have to do : LAST(filed!Value), how to get the value of the columns before the column containing LAST(filed!Value).
eg: If user choose january to december --> i want to get November value
If He choose January to march --> I want to get February value
I am working with ssrs 2008.
I hope my explanations are clear.
Thanks in advance for your help
LAST(Fields!ColumnN.Value) --> last column
??? --> Before the last column
I haven't tested this, but there is also a Previous function in SSRS that should be just what you're looking for. I don't know for sure if you can use these functions in conjunction, but I believe you could use the following expression:
= Previous(Last(Fields!ColumnN.Value))

SSRS select parameter month and change par. first and last day of this month

i need to create parameter list of months and then (after select) recalculate two others paramateres in date format ([first day] and [last day]) of this month, can you please help me?
You are querying a database server to generate the list of months, although there's no need to do that. I suggest to rather create a list of months in the report and let the report calculate the month's names, so the language depends on the Language setting of the report (which can be the language configured in the user's browser).
For example, to calculate the Label for the Value 1, use an expression like =MonthName(1).
The Parameters FirstDay and LastDay (or just the values whenever you need them) can be calculated using these expressions:
FirstDay: =DateSerial(Today.Year, Parameters!Month.Value, 1)
LastDay: =DateSerial(Today.Year, Parameters!Month.Value, 1).AddMonths(1).AddDays(-1)

How do I create a interval of 7 days without 'w','week' or 'WeekOfYear'?

I am trying to sort data by the week it was created. I can not use 'w' in DateAdd, 'week' or 'WeekOfYear' without an error stating that function/expression is inaccessible.
What is the best way to create a substitute expression? I want the expression to group the dates based on the week it was created.
I am trying to replicate this:
http://imgur.com/Pk8YjUv
Based on the expected results you posted in the edition of your question I have reproduced the tablix.
I've used the following dataset:
I am supposing you are going to use a tablix component so I added this one with the following data arrangement.
In the Row Groups panel right click on date group.
In group properties, add a group expression and set this:
=DATEADD("d",7-DATEPART(DateInterval.Weekday,Fields!date.Value),Fields!date.Value)
Also in the tablix you have to set the same expression:
In the columns you want to sum you can use the Sum function or any aggregation function. I've used =Sum(Fields!value.Value) to Sum values within the same week.
This is the result it will preview:
Let me know if this was helpful.

how use average function based in two differents dataset fields ssrs if one depend from the other one

im working with report that visual studio 2010 have, then i have a chart series with four fields planta, date, and densidad, i have to get the average of all the data that densidad has but only when the date is the same for example
Date Densidad
11/05/2015 2
11/05/2015 3
12/05/2015 4
in this case i have two data from 11/05/2015 the only for that date i must get the average that in this case should be 2,5 , ive been looking for an expression that works but i ve found anything, please?
Add a new row group, then go to the group's properties and group by date. In your tablix, add in AVG(Yourdataset!Yourvalue.Value) next to the date. This should group by date.
Your group expression should look like this:
=FormatDateTime(Fields!dates.Value, DateFormat.ShortDate)

How to get current month name in SSRS?

I need current month name as default perameter name in my ssrs report. How can I get current month name using an ssrs expression?
For example "27-09-2012" would become "September"
and one more i need....
27-09-2012 to previous month name as well (August)
First question:
=MonthName(Month(Fields!datefield.Value))
Second question:
=MonthName(Month(DateAdd("m", -1, Today())))
I think the second question answer might be something like that, first converting the date to month then subtracting 1 from the month value and then converting it to month name.
Further reading:
SSRS Reports get Month name from Month Index or from date
Converting month number to month name in reporting services
OFF: I would change the date format you are using to 2012-09-27 as it works in every setting and should give you peace of mind when converting date formats.
Don't subtract 1 b/c it won't work for January.
Use this:
MonthName(Month(DateAdd("m", -1, CDate(Today))))
As a note, I tried the suggestion of =MonthName(Month(today())). What I would get is #error for whatever field the expression was in. However, =MonthName(str(Month(today()))) worked for me. I am unsure of whether or not the MonthName method changed to require a string or if it is some issue with my program. Just figured I would post this in case anyone else was having the same issue.
For Previous Month i found universal way : =MonthName(Month(CDate(Today()))-1,False) for SEPTEMBER (Full Month Name) 'OR'
=MonthName(Month(CDate(Today()))-1,True) for SEP (Short Month Name)