Googl sheets function - google-sheets-formula

I need help with an equation for work I need to be able to highlight start date and end date if todays date is in range, so how I want it to work is when the start date of a premotion and end date is in range of today's date, I want the whole start and end date to be highlight until the premotion range is over so start date is A2 and end date B2
I've tried videos but the only tutorial that ive found is when a certain date land on the range then it is highlighted but I need the whole start and end date to highlight when it's in range of today's date and so on till the premotion is over

Try:
=($A2<=TODAY())*($B2>=TODAY())

Related

How can I change period to format date? - Quicksight

I have period date compose by 6 numbers, the first four numbers it’s the year and the last two is the month, example: yyyymm. (202201 )
The problem with this field is that sometimes changes between int and string. How can I change everything to a date format? dd/MM/yyyy
How can I change everything to a date format? dd/MM/yyyy

PowerBi - Show last week (Monday to sunday)

I'm fairly new to powerbi.
I want to be able to use a slicer to show the last week not the last 7 days.
I know you can use de relative week, but that shows the dates from Sunday to Monday.
I've also red that it's not possible to change the slicer settings for this.
Is it possible to archiev this in another way?
This is my date table https://imgur.com/a/dCcfBAZ
You can add a column that calculates last weeks' weeknumber and compares it to the weeknumber of the date in your row. Find the weeknumber for the current datetime (NOW), subtract 1, wrap that in an IF and you get a boolean to slice with:
LastWeek = IF((WEEKNUM(NOW(),2) - 1) = YourTableName[Weeknum],true,false)
Works the same as the relative week slicer option, but with the week starting on Monday.

declared variable expression conversion

Can anyone help me convert the following lines to SSRS expressions? I'm trying to return the dates in my SSRS report so users can see the data ranges they are returning data for. My data set queries are using the these to set the date parameters. Some of the functions don't seem to work in SSRS.
EOMONTH(Dateadd(Quarter,Datediff(Quarter,0,getdate())-2,0),2) --Beg of last Quarter
EOMONTH(Dateadd(Quarter,Datediff(Quarter,0,getdate())-1,0),2) --end of last Quarter
EOMONTH(Dateadd(Year,Datediff(Year,0,getdate())-1,0),11) --beg this year
EOMONTH(Dateadd(Year,Datediff(Year,0,getdate())-2,0),11) -- beg of last year
EOMONTH(Dateadd(Year,Datediff(Year,0,getdate())-1,0),11) -- end of last year
Hope this can help you
beginning of last Quarter =FormatDateTime(dateadd("q",datediff("q","1/1/1900",today)-1,"1/1/1900"),DateFormat.ShortDate)
end of last quarter
=FormatDateTime(dateadd("s",-1,dateadd("q",datediff("q","1/1/1900",today),"1/1/1900")),DateFormat.ShortDate)
Beginning of current year
=FormatDateTime(DateSerial(YEAR(Today),1,1),DateFormat.ShortDate)
End of current year
=FormatDateTime(DateSerial(Year(Now), 12, 31),DateFormat.ShortDate)
Beginning of the last year
=FormatDateTime(DateSerial(YEAR(Today)-1,1,1),DateFormat.ShortDate)
End of the last year
=FormatDateTime(DateSerial(Year(Now)-1, 12, 31),DateFormat.ShortDate)
Note I am using FormatDateTime to get short date, you can set the format as your requeriments.

Report Builder Month Function

In report builder how to filter a date field to get the current month? I'm looking for something equivalent to the Today() function (that gets you just today values).
Actually when I use =field.date.value(Today()), I get today date returned. I would like something like that for the current month instead of the current date.
Try this ,where i am getting the month value from the date of birth field.
=Cstr(Month(Fields!DOB.Value))

Subtracting between two dates for total days

i have three columns for Date In, Date Out, Total Days. If in Date In: 8/1/2011 and Date Out: 8/12/2011 Then the Total Days would be: 11 days. If Date Out is empty then Total Days = Current Date - Date In.
Problem: i cout get the total days if Date out is empty and using current date just fine, but getting total between date out and date in is giving me an error.
In the textbox in the reportviewer i have this expression:
=IIf(Fields!DateOut.Value=" "," ",Fields!TotalDays.Value)
The TotalDays is Current Date - Date In which i calculate in a stored procedure and just return the results.
I was thing of doing this but still i am getting an #Error in the textbox if i tried subtracting between date out and in if they are not empty.
=IIf(Fields!DateOut.Value=" ",DateDiff("d",Fields!DateOut.Value,Fields!DateIn.Value),Fields!TotalDays.Value)
Any suggestions.... Thanks
I know this is a little late, but i came up with the same issue. Here's what I did:
=CDate(Fields!DateOut.Value).Subtract(Fields!DateIn.Value).Days
Hope this helps!
Thanks for the info. Just wanted to share as I am not a programmer and this might be helpful to someone who is in my shoes that is required to write code.
I was able to create my formula from Answer 1. I had a requirement to have the Period End Date display the date 6 days prior. IE. EndDate = 06/24/2012 Field needs to display as 06/18/2012
=(CDate(Fields!EndDate.Value).AddDays(-6))

Resources