Hi every one i have the below matrix, and i need to have custom sorting,
By Cover Type (which is in rows)
Year (which is in Columns): the sorting should be based on year -1 instead of current year ex: 2019 instead of 2020
Brokerage: (which is in Values) sort Descending
can any one advise me how to do it .
Appreciate your assistance
Best regards,
Georges
You need to create custom columns which represents your sorting, if it is not possible with the raw data.
In the query editor for example add a custom column:
Your last year flag:
Last Year Flag = Date.IsInPreviousYear([YourDateColumn])
Just include everything you need for the sort order:
Cover Type Sort Order = if [Cover Type] = "A" then 1
else if [Cover Type] = "J" then 2
else if [Borkerage] = "G" then 3
else 4
Afterwards you can click on the three dots in the top right and sort by this custom column.
Related
I'm stuck with a problem in SSRS 2012 that maybe is very simple:
I have a matrix with a group row (employee) and a group column (last 12 months); the values are COUNT(practicesDone) - i.e. the amount of practices worked.
I want the matrix to show an extra column on the right (after all the columns of the months, and clearly outside the column group) with again the number of practices for the current month.
Is it possible to achieve that?
thank you in advance!
You can do this, it's pretty simple.
I have assumed that your dataset contains a column that has a date for each entry and that the data returned only covers 12 months so the same month would not appear for different years. If your data does have multiple years, look at the second expression below.
Right-click your month column and then to "Insert Column --> Outside Group - Right"
Now set the expression for the text box to
=COUNT(IIF(MONTH(Fields!myDateColumn.Value) = MONTH(TODAY()), 1, Nothing))
You could swap COUNT for SUM and it should do the same thing but either will work.
All we are doing here is comparing the all data in scope which, due to the placement of the text box means the scope is the entire rowgroup. Then for all that data, check if the month matches the current month, if it does set it to 1 is not set it to nothing then count/sum all results. Count conveniently ignores 'nothing'.
If you data covers more than 12 months then you can still do this but you'll have to add a bit more to handle years and months like this.
=COUNT(
IIF(
MONTH(Fields!myDateColumn.Value) = MONTH(TODAY())
AND YEAR(Fields!myDateColumn.Value) = YEAR(TODAY()),
1,
Nothing
)
)
I am new to SSRS and have a SUM(IIF question.
My data set contains four columns: Date, GroupID, PlanPaid, and NetworkIndicator.
Here is an example of the data set:
I am trying to SUM the [PlanPaid] amount when [NetworkIndicator] = "In Network".
However, I need this amount broken up by the [Date]. I tried accomplishing this by creating the expression:
=Sum(IIf(Fields!NetworkIndicator.Value = "In Network"
, Fields!PlanPaid.Value
, Nothing)
, "Claims_Rolling12")
But this expression returns the same amount (total) across all [Dates]. How do I break it up so that it is grouped by the correct [Date]?
Here is a photo of my Tablix and my current Groups: [Tablix and Groups]
And here is a photo of the output: [Output]
You haven't said where you want this sum to appear, so the answer here might not work. If it doesn't then edit your question to show what you expect the output to look like based on your sample data.
I'm assuming here that you want to add a new column to the report that shows "In Network total" by date.
The easiest way to do this is to add a row group that groups by date, then within this group you can use a simple expression, like the one you tried, but without specifying the scope.
=SUM(IIF(Fields!NetworkIndicator.Value = "In Network", Fields!PaidPlan.Value, Nothing))
This expression will only sum rows that are within the current scope, in this case the scope will be the row group you created to group by dates.
As IO said, if this is not helpful, edit your question and show what you expect your end result to look like, based on the sample data you supplied and then I can look at it again.
I have a matrix that creates 3 columns when it's run and I am unable to add a title to those dynamically created columns, as required by the client, and can't find any fixes or examples online. I hoped putting the matrix and textboxes into a table might work, but the same result as the images below occurs.
Is this seemingly simple thing just not possible, or is there a workaround I'm missing?
Design View
Result Textbox displayed after columns
Row and Column Groups visible
If you have 3 MTLH1 value for each NTLH2 value then you can do something like this...
(as you supplied no sample data I generated some from the sample WideWorldImporters database). My Query gives me 5 columns and results similar to the below.
CustomerCategoryName Qtr Mnth MnthName OrderValue
Computer Store 1 1 Jan 10
Computer Store 1 2 Feb 12
Computer Store 1 3 Mar 15
Computer Store 2 4 Apr 20
Corporate 1 1 Jan 11
....
Basically we end up with 3 months per quarter
I then added a matrix control to the report, dragged CustomerCategoryName to the rows, Mnth to the Columns , Qtr above Mnth so it becomes a parent column and finally OrderValue to the data "cell".
I actually swapped the Mnth field out for MnthName in the column header to make it easier to read, but the column order is still sorted by Mnth (the numeric version). I then centered the column headers for readability.
The final design looks like this
If we run the report, the result looks like this..
As you can see we have 4 groups, one for each quarter, each with 3 columns.
If you want to customise the quarter names, you could do that if required by changing the expression in the cell. For example if we wanted all quarters to have "Q" preceeding the number except the 2nd Quarter whcih we want to have a specific string then you could use something like.
=IIF(
Fields!Qtr.Value = 2,
"Second Quarter",
"Q" + Cstr(Fields!Qtr.Value)
)
The final output now looks like this...
Alternatively, you could generate all the column headers in t-sql so where I have MnthName you could create a Quartername or similar.
Hopefully this is useful. If not, please post sample data and expected results of that sample data and I'll revise the answer.
I have a report where my source gives me data for multiple years. In my report data I have 2 parameters- 1 is Brand and 2 is Year. I have made one matrix which has 5 columns in it with a row group. I want to define the column in such a manner where i pass a year to the parameter say 2016, but it automatically returns me data for that and previous year.
I tried using expression in the column group header:
=MAX(Parameters!Year.Value) OR MAX(Parameter!Year.Value) - 1
and
=MAX(Parameters!Year.Value) OR MAX(Parameter!Year.Value) - 1
Image of what I currently have:
What I want to see it as:
EDIT:
Dataset Sample:
You can exclude of your tablix the values you don't need to show.
Go to Tablix Properties window / Filters tab.
In expression use something like this:
=Switch(
Parameters!Year.Value = Fields!Calendar_Year.Value, "Include",
Parameters!Year.Value-1 = Fields!Calendar_Year.Value, "Include",
true,"Exclude"
)
Select Text and Operator select =
In Value use this:
="Include"
If you set Calendar_Year in the column group it will works.
Let me know if this helps.
I have a chart and matrix that shows records for a given date range. User wants to see the records for indidual months.If the user selects date range from January to April then the results would be 4 charts and 4 tablix based on month instead of single chart and single tablix that shows for all months. Could anyone please help me on how to do that. TIA
Create a list
Insert your existing Tablix/Matrix into the body of the list
Right click the Row header (grey box) of the List and on the General tab set the Group expression to group on the Month value, i.e.
=Month(Fields!myDate.Value)
Right click the Row header (grey box) of the List and on the Filters tab set two expressions.
Expression Operator Value
-------------------- -------- --------------------------
=Fields!myDate.Value >= =Parameters!StartDate.Value
=Fields!myDate.Value <= =Parameters!EndDate.Value
This approach will then take an output that looks like this (for all months)
When applied, and the parameters set so that StartDate = 01/Jan/2015 and EndDate = 28/Feb/2015, will look like this
Note how the data for each month appears separately.
Let me know if this approach works for you, or if you need any further assistance.