SSRS 2008 R2
I am creating an employee utilization report for one of our SSMS databases. If an employee has entered 40 hours of work in our system for a regular work week then they are at 100% utilization. However, we do not want to include overtime because we do not want the under utilization for an employee that did not enter their time to be offset by someone who reported overtime.
For example:
Steve has 32 regulars and forgot to enter his time for one day. he is at 80% utilization for the week.
Joe has 48 hours this week. 40 regular hours + 8 hours of overtime. Currently, the report is listing him as 120% utilization. This makes the total utilization for the group 100%, Ideally, Joe would be 100% utilized and therefore not compensate for Steve.
Here is what I have tried so far:
=SUM(iff(sum(Fields!HOURS.Value, "LABORNAME") > 40), 40, SUM(Fields!HOURS.Value, "LABORNAME")))
But I receive the following error message:
The Value expression for the textrun
‘Textbox105.Paragraphs[0].TextRuns[0]’ has a scope parameter that is
not valid for an aggregate function. The scope parameter must be set
to a string constant that is equal to either the name of a containing
group, the name of a containing data region, or the name of a dataset.
This is my first time posting to stack overflow so if I have mis-labeled or have not followed the correct format please let me know and I will edit the post.
You need to set your expression like the following and format as a percentage
=iif(sum(Fields!Hours.Value) >= 40 , 1 , SUM(Fields!Hours.Value)/40)
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.
I'm working on a simple RDBMS project. My database contains work hours per day of each employee. I have to calculate work hours of complete month. It is not a problem. But I have a problem, here it goes, each workday field contains either number of work hours or it may contain text such as if the employee was absent (symbol "A") for a particular day or it may contain symbol ("H") for holiday etc. Now my task is to calculate the 30 day work hours and exclude any symbol. But obviously the approach I am using will get me "Data Type Mismatch Error." So any body got any solution or any suggestion please. Thanks in advance!
I tried to use sum formula with NZ function, it doesn't work. Also tried Query with the same error.
Use Val:
TrueHours: Val(Nz([YourHourTextFieldName]))
That will return 0 (zero) for non-numeric entries, and that allows you to sum the values.
i'm currently working on a ssrs report. The report contains 4 parameters, only two are relevant to the question: no. 3 and no. 4. The label of parameter no. 3 are "12 periods" up to "24 periods", but the values are 12 up to 24 as integer.
This is what the report looks like:
enter image description here
For example if i choose the value "13 periods" (or higher) for parameter no. 3, the query retrieves data for 13 periods (or higher) startet with the last month depending on parameter no. 4. So the data are included the report. Now the column "Sum Consumtion" should be only store the Sum of the last 12 periods regardless of the parameter value no. 3 not 13 periods (or higher). So the Result is 67 not 77.
Any idea how can i do this?
Thx for your support...
You can do this by using a calculated field.
Add a calculated field to your dataset. The expression would filter it to the past 12 months. So it would be something like this:
=IIf(Fields!DateColumn.Value >= DateAdd(DateInterval.Months, -12, Parameters!EndDate.Value), Fields!ColumnToSum.Value, Nothing)
Now you can reference this new field in the total column. You would simply Sum it.
Depending on your date formats, you'll probably need to adjust the date comparison logic to meet your needs. If you don't have the End Date available in the report, add that first. It can be in the query or another calculated field in the report. But the idea is that you are getting a conditional sum.
I am using SSRS 2016 application to pull data from SharePoint list.
My task is to calculate the average DaysUsed and the average Percentage from a column.
It is a Matrix report which has two columns:
Sum(Fields!Days.Value)
Sum(Fields!Percentage.Value)
The task is to show the average days and average percentage.
I have tried the =Avg(Fields!Days.Value) but this shows wrong result.
UPDATE
Yes, the matrix is grouped by the Month to show each relevant month.
See the screenshot below what I have tested so far.
The DaysUsed is a calculated between 2 fields [FromDate] and [UntilDate] by summarising the total days minus the weekends. see below:
=(DateDiff(DateInterval.day,CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")), CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")))+1)
- (DateDiff(DateInterval.WeekOfYear,CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")), CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")))*2)
- IIF(Weekday( CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")),1) = 1,1,0)
- IIF(Weekday( CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")),1) = 7,1,0)
- IIF(Weekday( CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")),1) = 1,1,0)
- IIF(Weekday( CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")),1) = 7,1,0)
Furthermore, the [DaysUsed] row then consists of IIF(value is null then show 0 otherwise show the total value of days used).
=IIF(IsNothing(Sum(Fields!Days.Value)), "0", Sum(Fields!Days.Value) )
Sum(Fields!Days.Value)/CountRows()
Shall give you average days. Similarly goes for others as well.
If you has a field called Fields!Days.Value, I guess your data in the screenshot is already grouped by month. This means the expression
=Avg(Fields!Days.Value)
gives you the average over all Days (sum of all days / count of all days).
If you want to use the grouped values (by mounth) you either can use the following expression when you are inside the scope (the monthly socpe; indicated by the brackets on the most left side on your tablix)
=Sum(Fields!Days.Value) / Count(Fields!Days.Value)
If you are not in the scope you have to tell the tablix that is should use your monthly grouping. For this you can use the following:
=Sum(Fields!Days.Value, "YourMonthGroupName") / Count(Fields!Days.Value, "YourMonthGroupName")
I have a calculated member in SSAS cube which gives a percentage. In the cube browser this aggregates correctly but in BIDS SSRS it adds all the grains together to give a meaningless result. I know I could average the results but this isn't acceptable as I need a weighted average, which is why I created the calculated member in the first place. Help! How do I get this to work?
Here's the detail:
The calculated member in SSAS looks like this:
ActiveTimeVsExpectedActiveTime = (AvailableTime + TimeOnPhone + TimeInAvailable)/ExpectedTimeOnPhone
This works perfectly in the cube browser; it calculates correctly for all the individual telephone agents, and this feeds through the hierarchical group correctly to give a weighted result i.e. instead of adding together the result of the calculated member for each individual and calling that the team total, it sums together all the elements of the calculation and puts the results through the calculated member equation.
In SSRS however it just adds together the results of the individual calculated members and calls that the Team result. Help! I've searched online for a solution but can't find one. It doesn't make sense...why does the cube browser automatically calculate it correctly without any problem if SSRS doesn't - it makes calculated members rather pointless doesn't it?!
OK, so in response to Diego's question, I am including some of the data to clarify a bit further... The issue replicates on lots of calculated members; this is from the report I am building at the moment. T
he calculated member is Adherence = Adhering Time / Rostered Time
This is what it looks like in SSRS reporting:
Adhering Time Rostered Time Adherence
Team1 275736 366600 908.58%
Agent1 29355 30000 97.85%
Agent2 22041 33000 66.79%
Agent3 27493 30000 91.64%
Agent4 26689 30000 88.96%
Agent5 0 30000 0.00%
Agent6 27447 30000 91.49%
Agent7 30000 30000 100.00%
Agent8 28725 30000 95.75%
Agent9 0 32400 0.00%
Agent10 30142 31200 96.61%
Agent11 27201 30000 90.67%
Agent12 26643 30000 88.81%
As cou can see at the top of the data, it calculates the team adherence as being 908.58%, which is the sum of the adherence results of every agent.
SSAS cube browser shows exactly the same results for each agent but gives the team total as 75.21%, which it calcualtes as coming from 275736 adhering time and 366600 of rostered time.
Calculated Memberes are calculated at run time. Any chance the data changed between the interval you compared the cube and the SSRS. Also, are you sure the hierarchy you are using to compare is the same. The [Product].Name can be different if you are browsing the product attribute of a DimProduct dimension for example and the product on a hierarchy containing other members