I want to auto-fill the Due date column by taking the Start date column and add 1 month to it.
This formula I've tried in different ways:
=DATE([Start Date]+[Gap],"dd-mm-yyyy") (I created Gap column as number type and filled it with 28 days; in our language, dd-mm-yyyy seems to be the usual way of showing dates in Sharepoint).
Sharepoint keeps on giving back errors.
Try this formula:
=DATE(YEAR([Start Date]);MONTH([Start Date])+[Gap];DAY([Start Date]))
where [Gap] value is integer.
Note: pay attetion to delimiters - they are locale-dependent, most probably you need to replace , with ;
Related
I have a table of Employees. The Table has both current and budgeted employees. Each employees has a salary, start date and if applicable a term date associated with them.
I am attempting for project the salary spend for each month for the next year based on the following rules:
Hire_Date <= Projected_Month
Term_Date > Projected_Month
Measure:
CALCULATE(sum(INPUT_TECH[Salary_USD]),filter(INPUT_TECH,INPUT_TECH[Hire_Date]<=MEASURE_SWB_SPEND[MEASURE_SWB_SPEND_DATE]&&INPUT_TECH[Term_Date]>MEASURE_SWB_SPEND[MEASURE_SWB_SPEND_DATE]))
The issue here is that if ther is no Term_date, the cell will be blank, and if the cell is blank, the term_date will always be less than the current projected month and therefore the answer will always be 0.
I attempted to fix this by changing the format of the termdate to always either have the number 100,000 formated to read "ACTIVE" or the date they were actually terminated
Format: [=100000]"ACTIVE";[<>100000]mm/dd/yyyy
However, I still receive the following error:
DAX comparison operations do not support comparing values of type Text with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values.
I would suggest not formatting the term date to the string "Active" and then using it for comparisons in your measures. This is why you may be getting that specific error. DAX is finding a data-type issue when making the comparisons. If you want the term to show up as "Active" where term dates are blank for visualization reasons, that may be okay. But I would establish a new calculated column that determines if a term date is blank and replaces it with a date type far into the future so that dates can be compared among dates—something like:
Term Date Blank Fix =
IF(
ISBLANK( INPUT_TECH[Term_Date] ),
// The third argument below could be replaced with a hard year, ex. 2099
DATE( 12, 31, YEAR( TODAY() ) + 10 ),
INPUT_TECH[Term_Date]
)
Then you could use the above column to make your comparisons in your measures. Keep in mind that if you are using a date table with AUTOCALENDAR() that making a date with the year 2099 may wildly expand your date table.
I have the a month slicer based on month number, I want to create a filter with the between format like below :
By default, when loading the report the left side will have the value of 1 (the month number of January) and the right side will have the value of the current month (the month number of October in this case)
First create a table using this below code-
month_list = GENERATESERIES(1,MONTH(TODAY()))
Now create the slicer using the Value column. Output will be as below-
I am creating a report with buttons that use a slicer to show the last 3 calendar months, the default view, and YTD. The first two are all set and will continue to work fine, however i am having trouble with the YTD filter because i need it to exclude the current month (some of the key metrics for this slicer are only accurate monthly, even thought the data is updated Daily). Any idea how to accomplish this without me having to manually change it every month? An example of it working today would show me 2020 through August, since September is not complete. September would be included in the filter starting October first. I am thankful for your help/insights!
I typically build a calculated column on my date table called something like "Date in Range", that looks something like the below. You could also apply this to a date in a normal table if you are not using a date dimension.
Date in Range = IF ('MyTable'[Date] <
DATEADD(TODAY(), -1 * DAY(TODAY()), day),
1,
0)
This compares the date in the table row with TODAY(), e.g. 14 Sep 2020, minus the day of the month of today (14), effectively getting you back to the start of the current month. This will then return 1 for dates before the end of last month or 0. Filter on 1 or 0 to get your result (or use something more meaningful in place of the 1 or 0).
I have used the following to get the stating day of the month
multiemp[Day] - WEEKDAY(multiemp[Day],2)
For example if my date us 22 May 2018, after using the above query, got the expected out put.i.e., 20 May 2018
Now I tried to get the month name by using the above query and format function
format(month(multiemp[Day] - WEEKDAY(multiemp[Day],2)),"mmm")
results were not expected, instead of may January is getting populated.
when verify with the following month function expected results arrived .i.e, 5
month(multiemp[Day] - WEEKDAY(multiemp[Day],2)
but only issue in changing the month number to month name
Please find below:
formulas used
weekstartday = multiemp[Day] - WEEKDAY(multiemp[Day],2)
weekstartday_month = month(multiemp[weekstartday])
Month_name = format(multiemp[weekstartday_month],"mmm")
another_ans = format(dateadd(multiemp[Day],-weekday(multiemp[Day],2),day),"mmm")
another_answer_date = dateadd(multiemp[Day],-weekday(multiemp[Day],2),day)
EDIT: Day 2
Modified the datatype of the column to date time/timezone.
after refresh the data didn't change
Found out the solution
Solution 1:
mnname = format(multiemp[weekstartday].[Date],"mmm")
Solution 2:
Month_name = format(date(YEAR(multiemp[weekstartday]),MONTH(multiemp[weekstartday]),day(multiemp[weekstartday])),"mmm")
Thanks in advance
Format the column instead of repeating the column DAX statement.
Column = FORMAT(*nameOfYourStartOfWeekColumn*,"mmm")
Because FORMAT(...,"MMM") or FORMAT(...,"MMMM") takes as an argument a date types and non numeric types, try this
format(dateadd(multiemp[Day],-weekday(multiemp[Day],2),day),"MMM")
If you want the starting day of the week as monday, then,
format(dateadd(multiemp[Day],-weekday(multiemp[Day],3),day),"MMM")
EDIT
Verify that date column is date or date\time type.
Solution 1:
mnname = format(multiemp[weekstartday].[Date],"mmm")
Solution 2:
Month_name = format(date(YEAR(multiemp[weekstartday]),MONTH(multiemp[weekstartday]),day(multiemp[weekstartday])),"mmm")
In my SharePoint list, I have a field containing one of three possible values. Depending on the value and a secondary field containing the date submitted, a due date will be calculated (adding 1, 3 or 14 days) to the date submitted but this date cannot land on a weekend and must not count the days as workdays.
I have tried numerous if, and, weekend combinations with no luck. My co-workers are also stumped.
Any assistance is greatly appreciated. Thank you
Assuming a column named "Days" and a column named "TheDate" where "Days" contains the 1, 3, 14 or a formula to select one of those values.
= TheDate+Days + IF(WEEKDAY(TheDate+Days)=1,1,0) + IF(WEEKDAY(TheDate+Days)=7,2,0)
This adds the "Days" to "TheDate" and then:
checks to see if the new date is a Sunday, and if so, adds 1
checks to see if the new date is a Saturday, and if so, adds 2