I am using SQL Server Report Builder to generate a weekly report to show the weekdays Monday - Friday and then the relevant dates.
The report pulls the information from a calendar in SharePoint 2016.
Instead I have created 5 columns with static weekdays and the week dates:
The following generates the weekdays:
=IIf(UCase(Format(Fields!Start_Time.Value, "dddd"))="MONDAY",FORMAT(Fields!Start_Time.Value, "h:mm tt ") & FORMAT(Fields!End_Time.Value, "- h:mmtt"),"")
The following generates the week dates:
=FORMAT(Today.addDays(1-weekday(Today,FirstdayOfWeek.Monday)),"dd/MM/yyyy")
Screenshot of the SQL Report
Which means show the date/time of each weekDay otherwise leave blank.
The problem with this approach is that does show all the entries even those of last week ...
The purpose is to show only for current week.
Unfortunately, I am out of ideas and not sure what else can be done?
UPDATE
I have managed to find a way around this :)
The expression needed to be:
=IIf(FORMAT(Fields!Start_Time.Value,"dd/MM/yyyy")=FORMAT(Today.addDays(1-weekday(Today,FirstdayOfWeek.Monday)),"dd/MM/yyyy"),FORMAT(Fields!Start_Time.Value, "h:mmtt ") & FORMAT(Fields!End_Time.Value, "- h:mmtt"),"")
Related
I am trying to produce a report that will pull a date already in a table somewhere and then show this date with 16 working days added on, below is the code I currently have;
SELECT d.CASENUM
,DATEADD (DW, 16, (d.ORDERDATE)) AS [PayDate]
FROM db.ORDERS AS d
WHERE d.CLIENT = 'STORE1'
The only issue I seem to having is that the DATEADD isn't adding 16 working days
27-01-2021 Is the last date in my table, so +16 working days should be 18-02-2021
but my results are giving me a date off 12-02-2021 and I can't figure out why..
I am using SQL Server Management Studio v18
Any help would be greatly appreciated.
I'm afraid what you'll have to do is create a new table for the Working Days. The issue is that different countries (and states) have different definition for Working Days.
So the table should look something like this
Date
State (or Locality)
Day of Week
Is Working Day
You can either use a running id for Working Days, alternatively use Windows Functions (RANK)Rank Windows Function
Sorry guys - new to this - complete novice.
I am pulling data from a SQL Server from Excel using Microsoft Query.
I'm currently limiting fields to just invoices within a date range using:
=#10/1/2017# And <#10/31/2017#
My date format is:
2017-10-02 00:00:00.000
I run this report many times during the current month - so I need to change the string above when the new, current month, begins.
I'd love for someone to give me the command that will always pull the current month - regardless of the month - thus allowing me to not have to alter the condition when a new month begins.
Thank you in advance.
The question is not so clear but here is what you can try with:
To find today with date and time:
=NOW()
To find the beginning of the month:
=EOMONTH(A2,-1)+1
To find the end of the month:
=EOMONTH(A2,0)
Let me know if this is what you are expecting.
Using qlikview 8 personnel edition.
On my main tab i have a chart that concats year and period (year and month) from this I use it as a filter to select periods, this works fine except when trying to select multiple years and periods, it allows selection but say:
Select all from year 2013, and up to year 2014 month 09. It actually selects all from 2013 and 2014.
why would it be doing this?
Some details:
=Num#(If(Len(Year & Period)=5,Year & '0' & Period, Year & Period))
outputs "201301" etc
Like I said i can select whatever month upto a month i want withing a year. However doing the same over multiple years forces it to select all months.
Because the year & month columns are separate in your model, making the selection that you described actually DID select all of the months. You got them from 2013. It didn't care that you only hoped to limit to 1-9 for 2014.
If possible, move that concatenation to the load script where it can become its own field and then you should be good to go.
I have created a matrix with the groupings below in SSRS 2008 R2 and SQL Server 2008 R2.
MembershipStatus has "New Enroll", "Term", "Active".
What I need to do is to add a row called "Other" to do the following calculation:
Last month new enroll + last month active – this month term – this month active
In the example below, it's
19,281 + 0 - 2,082 - 17,195 = 4
I've used temp tables and various combinations of APPLY to get the results I need in SQL, but due to the large number of parameter combinations, I really need to do it inside SSRS.
Should I just give up and code it in the CODE section of the report?
Any insight would be greatly appreciated.
Try using the ReportItems function. Each text box in SSRS will have unique name which can be found by selecting the respective text box and then checking the top most section in the properties window displayed on the right side.
Let's say your NEW ENROLL value for June is displayed in Textbox1, TERM FOR June in Textbox2, ACTIVE for June in Textbox3, NEW ENROLL FOR July in Textbox4, TERM for July in Textbox5, ACTIVE FOR July in Textbox6 and so on. Write the below expression for OTHER value for July as below:
=ReportItems!Textbox1.Value + ReportItems!Textbox3.Value - ReportItems!Textbox5.Value - ReportItems!Textbox6.Value
This formula will change based on the default naming by SSRS for the respective textboxes.
With the calculation provided, it only allows to do the calculation in the same month. The question is how to calculate numbers in the previous month against current month...
how could it be done?
I have a challenge saving the date to an MS Access 2007 database especially for dates with the day less than the 12th of a month (i.e. the day between 01 to 11) If for example a February date - 07/02/2013 (dd/MM/yyyy) will be saved as 02/07/2013 in the database. While a similar February date 14/02/2013 will also be saved 14/02/2013. Retrieving the two dates: The first date will brought out as 2nd July and the second date will be 14th February.
Notice that the day and month values is transposed for dates less than the 11th. This happens when I use an update query (either from VB 2005 or directly within MS Access using SQL pane). I have set both the system short date settings (in Windows 7 OS) and the Date Format at field level (in the MS Access Table) to dd/MM/yyyy.
try - DateValue("dd-mm-yyyy")
or - Format(Date,"dd-mm-yyyy") as an expression builder.