I'm wondering if anyone has an elegant solution for generating days based on a month selected for use in a dropdown. What i'm wanting to do is for the user to select the month, then populate a dropdown for days for that month. So for example if the user selected january you would have a dropdown list with values 1 - 31. The only bit i think might be tricky will be to do with leap years, so it may need to pass in year as well. Any ideas would be most appreciated :)
for calendar and get day of month use 'moment'
moment("2012-02", "YYYY-MM").daysInMonth() // 29
moment("2012-01", "YYYY-MM").daysInMonth() // 31
Related
I'm working with Big Query and I need to get first day of week.
For example if date = '2022-08-26' I want to have '2022-08-22' where 22 is Monday.
Any solutions please ?
Thanks in advance.
To achieve this you'll want to use the DATE_TRUNC function as follows:
select date_trunc(date('2022-08-26'), WEEK(MONDAY))
You can change the parameter for WEEK to be any day of the week, default is SUNDAY.
Documentation can be found here:
https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date_trunc
I am trying to come up with a simple formula that I can extend infinitely to show me a list of dates that is separated by 2 weeks (14 days) and also includes the first of the month. The 2 weeks part is easy to accomplish with:
=A2+14
Where A2 has a date in the field to start the calculations. Then I can extend that down the column to have:
=A3+14
=A4+14
And so on... The hard part is, I also want to include the first of each month. So the list should include every other Friday and the first of the month dynamically. So the results would be like this:
2/28/2020
3/01/2020
3/13/2020
3/27/2020
4/01/2020
4/10/2020
As you can see from this list, it looks at every other Friday AND the first of the month is included in the results. I tried something like this:
=IF(MONTH(A3+14)>MONTH(A3),eomonth(A3+14,-1)+1,A2+14)
The issue from this one is that if the first of the month condition gets selected, the next date is 14 days AFTER the first of the month. It should be 14 days after the previous Friday.
try:
=ARRAYFORMULA(SORT(UNIQUE({
EOMONTH(ROW(INDIRECT(C1&":"&C2)), 0)+1;
FILTER(ROW(INDIRECT(C1&":"&C2)),
MOD(ROW(INDIRECT("A1:A"&DAYS(C2, C1)+1)), 14)=0)+1})))
I have a calculated field in my report that gives me the number of days between two fields. This is in calendar days though.
=DateDiff("d",Fields!Date_Reported.Value,Fields!EventDate.Value)
I have been asked to include number of working days and I'm struggling!
Is it possible to count the number days between these fields using only working days? eg. Monday to Friday in this case?
Thanks in advance for any help.
Try this:
=datediff("ww",Fields!Date_Reported.Value,Fields!EventDate.Value, vbMonday)
+datediff("ww",Fields!Date_Reported.Value,Fields!EventDate.Value, vbTuesday)
+datediff("ww",Fields!Date_Reported.Value,Fields!EventDate.Value, vbWednesday)
+datediff("ww",Fields!Date_Reported.Value,Fields!EventDate.Value, vbThursday)
+datediff("ww",Fields!Date_Reported.Value,Fields!EventDate.Value, vbFriday)
The source
I have a data set that has dates for many years. I can easily filter the data by month or week, but I was hoping to change the X axis to make it start in October and end in April.
Is there a way to do this in Tableau without altering the original data and listed dates?
I don't know about it ending in April since that would not be a full 12 months but you can make it start in October. Right click on your date field > Default Properties > Fiscal Year Start. Then select October.
I'm looking to get a snapshot of inventory for the latest date of each month.
I.E.
Feb 13
Jan 14
Feb 14
There are duplicate variables - i.e., "a" will be listed several times each month. I need to get a.) the sum of each month (easy), and b.) the snapshot of the last date available.
Part B.) is what I'm having trouble with. I've seen the EOM excel formula - but it requires entering (current, following month, etc.). I just want the formula to spit out the inventory Quantity for the last date of each month, without having to specify which month (current, following, etc.).
Any ideas?
Thanks!
I'm assuming that your data is structured something like this:
http://i.stack.imgur.com/mF3h0.png
If that is the case, you can use a formula like this:
=VLOOKUP(EOMONTH(A12,0),$A$2:$B$5,2,FALSE)
Where A12 is the month you want to find the answer for. So the full sheet looks like this:
http://i.stack.imgur.com/GR5ok.png
As you can see, the formula that I put into cell B12 and then just dragged down is pulling back the correct values for the end of month inventory count. Just populate column A with the month-year you are searching for.
Hope this helps!