I am Using Crystal Report with VS 2012 with Dataset and Populating the Report with Run Time.
I am getting Repetitive rows for My Report, It is because the Data is Entered with Different Period (Month/Year) like the salary of Person for Month and Year.
So What I thought to get rid of the Repetition of rows is I am going to Get the Values of Summarized (Group footer) portion of a Particular Employee instead of GETTING DETAIL SECTION where Every record repeats instead of Period. I have achieved it, But the Problem is the Minimum Function is not getting the accurate Minimum Period as Shown the picture.
The formula for I which I used to Show Minimum and Maximum period values is:
Maximum ({DataTable1.Period}, {DataTable1.PPO_NO})&" - "& Minimum ({DataTable1.Period}, {DataTable1.PPO_NO})
and My Formula for getting Employee Month and Year are:
SELECT PPONO, Name, Father_Name,Designation,BPS,Claimant,Age,Type,IOT, TblPPOBook.Pay_Month + '/' + CAST(TblPPOBook.Pay_Year AS nvarchar(4)) AS Period, Pension, Allow etc. From EmployeeTable Where PayDate Between Date1 ANd Date2.
The Early help in this regard will be highly appreciated.
Create a formula to convert string to date i.e
#String to date:= Datevar Date_Period:=CDate({Period});
Second use this formula to find min and max date i.e
Maximum ({#String to date}, {PPO No#})& " to " & Minimum ({#String to date}, {PPO No#}) ;
Related
I want to do a forecast model in excel, which automatically calculates the expected monthly values of a certain variable.
Table A (Output table):
here, I want to show the expected end of month value for a patientF.ex. I want to forecast the total value of X for Person A for the whole month of October
enter image description here
Table B (Data table):
Here, I receive a daily import from an SQL database with the relevant Person Data for that day
F.ex. on the 15.10.2021 I would receive the following:
enter image description here
In short, I would like to do the following calculation in my output table B:
Return Value of "Number of X", given that "Patient" =Person A for the MM/YYYY match (if successful, this should show 13 for person A/October in the output table)
Secondly, I want the above value to be divided by the number of days of that particular date (so 15 days in this example)
Thirdly, I want to multiply it by the total number of days for that given month (as indicated in the Output table/Date section)
I have tried different sumifs/array formulas but I really struggle with one consolidated formula. Any help/tips much appreciated!
I have an ssrs report that shows revenues for each month of a year for several years based on start and end date parameters the user enters. What I would like to do is add a second column that shows the revenue for that quarter (march would show q1 revenue, june q2 etc). the problem I am having is that I am able to do this for a single year but once the query starts looking at multiple years my column shows the value for all 1st quarters regardless of year. The picture shows what I am currently getting. Any recommendations on how to fix my expression to also look at the year value when summing these quarters?
Here is the code I am using to only populate the quarter column based on the month.
=IIF(Fields!Sort_Order.Value=3,
Sum(Lookup(1,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(2,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(3,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=6,
Sum(Lookup(4,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(5,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(6,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=9,
Sum(Lookup(7,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(8,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(9,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=12,
Sum(Lookup(10,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(11,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(12,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),""))))
I ended up creating a quarter column within my data set that was then used as a parent group for the month rows. I then hid that column and added a total for the quarter that gave me sub totals. Not exactly what I was looking for but gave me the result I needed.
I need to create a Measure that would display the number of tasks that are over due, based on today's date.
So basically I need to translate this into DAX in power BI?
SUM(If DueDate is greater then today then count it as OverDueTask)
I tried to do something like that but when trying to display it it says:
Cant display the visual
OverDueTasks = CALCULATE(SUM(TotalCounts[DueDate]), FILTER(TotalCounts,[DueDate]>TODAY()))
I tried your formula and the issue appears to be the SUM. You are summing dates so Power BI is going to treat them like dates, but the formula goes past the threshold for dates. Change the SUM to a COUNT and it should work.
OverDueTasks = CALCULATE(
COUNT(TotalCounts[DueDate]),
FILTER(
TotalCounts,
[DueDate] > TODAY() &&
[CompletedDate] = ""
)
)
you should first create a calculated column with formula
=IF(Table1[DueDate]>TODAY()|1|0)
Then a measure to sum this up
Overdue:=SUM(Table1[Calculated Column 1])
This should be simple so I think I am missing it. I have a simple line chart that shows Users per day over 28 days (X axis is date, Y axis is number of users). I am using hard-coded 28 days here just to get it to work.
I want to add a scorecard for average daily users over the 28 day time frame. I tried to use a calculated field AVG(Users) but this shows an error for re-aggregating an aggregated value. Then I tried Users/28, but the result oddly is the value of Users for today. The division seems to be completely ignored.
What is the best way to show average number of daily users over a time frame? Average daily users over 10 days, 20 day, etc.
Try to create a new metric that counts the dates eg
Count of Date = COUNT(Date) or
Count of Date = COUNT_DISTINCT(Date) in case you have duplicated dates
Then create another metric for average users
Users AVG = (Users / Count of Date)
The average depends on the timeframe you have selected. If you are selecting the last 28 days the average is for those 28 days (dates), if you filter 20 days the average is for those 20 days etc.
Hope that helps.
I have been able to do this in an extremely crude and ugly manner using Google Sheets as a means to do the calculation and serve as a data source for Data studio.
This may be useful for other people trying to do the same thing. This assumes you know how to work with GA data in Sheets and are starting with a Report Configuration. There must be a better way.
Example for Average Number of Daily Users over the last 7 days:
Edit the Report Configuration fields:
Report Name: create one report per day, in this case 7 reports. Name them (for example) Users-1 through Users-7. These are your Row 2 values. You'll have 7 columns, with the first report name in column B.
Start Date and End Date: use TODAY()-X where X is the number of days previous to define the start and end dates for each report. Each report will contain the user count for one day. Report Users-1 will use TODAY()-1 for start and end, etc.
Metrics: enter the metrics e.g. ga:users and ga:new users
Create the reports
Use 'Run reports' to have the result sheets created and populated.
Create a sheet for an interim data set you will use as the basis for the average calculation. The first column is date, the remaining columns are for the metrics, in this case Users and New Users.
Populate the interim data set with the dates and values. You will reference the Report Configuration to get the dates, and you will pull the metrics from each of the individual reports. At this stage you have a sheet with date in first columns and values in subsequent columns with a row for each day's values. Be sure to use a header.
Finally, create a sheet that averages the values in the interim data set. This sheet will have a column for each metric, with one value per column. The one value is calculated from the series in the interim data set, for example =AVG(interim_sheet_reference:range) or any other calculation you'd like to do.
At last, you can use Data Studio to connect to this data source and use the values. For counts of users such as this example, you would use Sum as the aggregation field type when you are creating the data source.
It's super ugly but it works.
I have the following payroll table in an SSRS 2008 (R2) report:
The dataset returns labor transactions consisting of the following fields:
STARTDATE
STARTTIME
FINISHDATE
FINISHTIME
REGULARHRS (difference between finish and start)
REFWO (such as "Travel", "Holiday", "Work", etc and is used to sort into the categories shown in the table above)
TIMEWORKED (0/1 flag that indicates whether or not it counts towards "Time Worked" category)
I have a column grouped on STARTDATE so that it displays each day of the week (our weeks go Mon through Sun). Everything down to "Unpaid Time Off" is a simple expression (usually just in the format Sum(IIF(something,A,B)) in both the daily column and the weekly (Totals) column. In the "Interim Regular" box (for the day grouping), I have the following expression:
=IIF(Weekday(Fields!startdate.Value)=1
OR Weekday(Fields!startdate.Value)=7
OR ReportItems!Holiday.Value>0,
0,
ReportItems!TimeWorked.Value-ReportItems!Holiday.Value-ReportItems!Bereave.Value)
Basically what I'm doing is saying: If STARTDATE is a Saturday, Sunday, or Holiday, the regular hours would be 0 since it would fall into OT1.5 (overtime, time and a half), otherwise I calculate the regular hours worked by subtracting Holiday time and Bereavement time from the Time Worked (since both are included as part of Time Worked). This part works great!! But when I try to sum up the total for the week using =Sum(ReportItems!InterimRegularDaily.Value) it tells me that I can't use an aggregate on a report item and that aggregate functions can be used only on report items contained in page headers and footers. I've done extensive googling to see if there is a solution, but everything seems to involve writing custom functions. I can't believe it would be THAT hard to simply sum up a group calculation in an outer group!
Any and all help would be greatly appreciated!!
Thanks!
You can add the scope the your Sum() expression to reverence the the whole dataset or a group:
'Returns the sum of the whole DataSet
=Sum(Fields!TestField.Value, "YourDataSetName")
'Returns the sum of a group
=Sum(Fields!TestField.Value, "YourGroupName")
You can also stack them:
=Sum(Sum(Fields!TestField.Value, "Level3GroupName"), "Level2GroupName")