I am creating a line chart to show sales prospecting data. I have 4 sets of values: Monthly Revenue at 100% confidence, Monthly Revenue adjusted to actual confidence %, Yearly Revenue at 100% confidence, and Yearly Revenue adjusted to actual confidence %. I'm using a RunningValue() function to calculate the "Yearly" values, both 100% and adjusted, which are separated as a Series Group on each year. The RunningValue is working perfectly, but I would like the line to end at the end of the year (or series), rather than plateauing through the rest of the graph. I'm thinking using an expression on the Pick Color selection, so that if the Year is greater than current running year, set it to No Color, but I'm not sure how to write that expression.
The highlighted yellow areas are what I would like to remove.
A minor supplemental question is, can I eliminate the doubling up of the legend that occurs from the Series Group separation, which I need to use because I want the separate line rather than having a drastic drop between years.
Add a condition to your running value expression so that it evaluates the year. I would use this on the value rather than the Color.
=IIF(YEAR(FIELDS!YourDateField.Value) <= YEAR(TODAY), <YOUR RUNNING TOTAL EXPRESSSION> , NOTHING)
Use de 'Field Scope' in the RunningValue() expression. This way, the ruuning 'resets' every year.
=RunningValue(Fields!MonthlyRevenue.Value,sum,"NameOfYearField")
Related
I am working on a sample project in Power BI Report Builder. (I couldn't tag it as such because apparently I'm not allowed to create my own tags on this website.) The measure I am going for in my data cube is called Direct_Claim_Deductible_Recoverable_End_of_Year, but we will call it "Deductible" because that's too long a name to type out every time. I am trying to divide it up by the fields of State, City, and Year.
The Category column tells you whether each row is for a state or a city within that state. The Year and Location columns tell you the year and location that the row is telling you about. The Deductible column shows that measure. The Pct% column formula is Deductible - Total. (I added the Total column because I was having trouble with the Pct% column and wanted to know what was going on.)
Here's where the problem begins.
The Total column is supposed to tell me what the total deductible is for that specific year. But instead, it just gives me the grand total for all years in the cube. I've run the report enough times to know that this number is $99,669.71.
Here is the formula I am using for the Total column:
=round(Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value),2)
The Pct% column is giving me wrong answers too, but it is based on the Total column, so fixing the Total column should also fix the Pct% column.
And the data bar is supposed to show me what percent of the total for that year is in that state's row, or what percent of the total for that state is in that city's row. Instead it gives me an error message saying I am missing a closing parenthesis ')' somewhere:
The Maximum expression for the chart 'DataBar2' contains an error: [BC30198] ')' expected.
Here is the code I used:
=(Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value) / (Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value), "StateDS"))
As you can see, all three sets of parentheses are opened and closed.
I did figure out that if I move all the parentheses to the end, like so:
=(Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value) / (Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value, "StateDS")))
I resolve that error message but get a different one:
The ValueAxis_Primary.Maximum expression for the chart 'DataBar2' has a nested aggregate that specifies a dataset scope. Inner aggregates cannot specify a dataset scope.
It seems to be telling me that I cannot have the denominator of the fraction for the City data bar specify that its scope is the dataset "StateDS", which is the dataset that aggregates by State alone. But I am confused. I don't understand why that would be. And I don't understand what I need to do to make it aggregate by state anyway.
Thank you.
First post in stackoverflow - so forgive me if I don't get this right. I have an SSRS report with a matrix which groups Quantity, Total Spend and Average Cost by part number for each year. Part Number and description down the left and the the years along the top. I want to add a delta column in each year after the first year which shows the change in price from the previous year. I have seen examples of how to get the difference between first and last year - but not the difference between each year and the previous one. I have hidden the delta column for the first year - no would love some guidance on how to calculate the difference in cost.
So from the image below the first row in the delta column under FY2019 would show -€0.01 as price has reduced from 0.59 to 0.58.
You haven't explained how if Avg. Cost is calculated in your report but I'm assumming it's just something like =SUM(Fields!Spend.Value) / SUM(Fields!Qty.Value)
You've not shown your report design so I can't tell what your row/column groups are called but I'll assume you have rowgroup by Part and one by Year. Let's assume your column group name is PeriodID so it's the same as my demo report.
In this case you can use the PREVIOUS() function to get the previous values to compare against.
I set up a similar report to demonstrate. As you can see in my case the year column is grouped using a columngroup called PeriodID
The expressions highlighted are as follows.
Price. This is just Cost/Qty =SUM(Fields!Cost.Value)/SUM(Fields!Qty.Value)
lastprice. This is just for illustration and debugging. It uses the PREVIOUS() fucntion to get the previous year's data
=Previous(Sum(Fields!Cost.Value), "PeriodID") / Previous(Sum(Fields!Qty.Value), "PeriodID")
Note that "PeriodID" is the name of the column group (case sensitive). This is scope for the previous function so it know to get data from the previous column group.
delta. This is the final output. It's just the current "Price" expression minus the "lastprice" expression.
=(Sum(Fields!Cost.Value) / Sum(Fields!Qty.Value)) - (Previous(Sum(Fields!Cost.Value), "PeriodID") / Previous(Sum(Fields!Qty.Value), "PeriodID"))
The final output looks like this (I've not hidden the column for the first column group or hidden last price, just so you can see it working). Also, if you see slight differences in the delta column compared to what you might expect, it's just down to the fact that the numbers are formatted to 2 decimals but my test data is up to 14 decimals.
I am using SQL Server Reporting Services 2016, I need some advice on the following statement I have in the top row of a Tablix in SSRS inside a textbox, the stament has a few expression within the text:
The total number of referrals received so far in this reporting period
is 1427. This is a -6% «Expr3» when compared to the 1518 received in
the same period of the previous reporting year.
In this example I would like «Expr3» to say "Decrease" because -6 is a negative number.
«Expr3» ---The issue I have is I need to work out <>, I would like to display either Increase or Decrease based upon the value of «Expr2», if «Expr2» is a positive number then I want this value for «Expr3» to show the word "Increase" and if «Expr2» value is a negative number then I want «Expr3» to show "Decrease".
Below my value behind the other expressions
«Expr1»
=Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod")
«Expr2»
= ((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
Is there an expression which can do this for me?
Thanks
Your expression for Expr3 should be something like this:
=IIf(
((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
>= 0,
"Increase",
"Decrease"
)
This expression assumes that you want to include 0% as an increase, that can of course be changed to fit your needs by modifying the >= 0.
If you are going to have the word "increase" or "decrease" after the percentage though, you may want to display the absolute value of the percentage -- this may just be semantics but it would be a little confusing to me to see a "-6% Decrease", as the double negative implies an increase. If you wanted to change that, just wrap Expr2 in the abs function like so:
=Abs(
((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
)
Take Datetime and give the half hour band it belongs to, irrespective of the date, just interested in the time.
There is as far as I can see, no time periods in SSRS, I need half hour time periods, that's 48 blocks in a day.
I would like to plot my data in bar chart,the interval for the bar width is along the x axis, the height is the occurrences on the y axis. I need an interval of half hour(the width of the histogram),I don't want to run some IIF/CASE statement, I would rather, convert the DateTime i have to a band on each row of data, what's the best way to output so I get half hour intervals along the X axis.
I don't want to run some IIF/CASE statement
By this I assume you mean you don't want 48 layers of IIF/CASE. Here's an SSRS expression that'll band a datetime just using a single IIF:
=DateAdd(DateInterval.Minute, 0-
IIF(Minute(Fields!DATETIMEFIELD.Value) <= 29, Minute(Fields!DATETIMEFIELD.Value), Minute(Fields!DATETIMEFIELD.Value) -30),
DateAdd(DateInterval.Second, 0-Second(Fields!DATETIMEFIELD.Value) ,Fields!DATETIMEFIELD.Value))
This removes the seconds from the time, and removes as many minutes necessary to get to the previous half-hour. You could likely use the same logic with different syntax as a column in your SQL query, if you prefer.
Use this calculated value for all the relevant parts of your SSRS chart.
I am somewhat new to SSRS and I have built a matrix report that looks fairly simple:
Supplier [AccDate]
[SupplierName] Sum(PurchasingCredit)
Total <<Expr>>
The actual report shows month-by-month sales data for a year in addition to Current YTD and Previous YTD columns (joined via UNION clause in base query) in addition to a column showing Year-over-Year % as difference between the Current YTD and Previous YTD columns (also joined via union).
I was able to apply a dynamic format to the Year-over-Year column using the following expression in the Format property to show the YOY column as a percentage and the others as dollar amounts:
=IIF(Fields!AccDate.Value <> "YOY", "'$' #,0.00;'$' -#,0.00", "#,0.00 %;-#,0.00 %")
The last thing I need to do is to show the column totals, which are working for each column with the exception of the year-over-year percentages using the following:
=IIF(Fields!AccDate.Value <> "YOY", SUM(Fields!PurchasingCredit.Value), 0)
In the year-over-year (YOY) column, a sum of percentages doesn't make sense: I need it to recalculate this value based on the sums of the "CYTD" and "PYTD" columns, but I can't seem to figure it out. Any help would be greatly appreciated. I am guessing it is probably an application of scope, but the MS articles that attempt to explain this are very confusing.