weekday
9 TopicsWeek start day monday
Hello guys, I need to check if the day is a weekend or not, knowing that the week should starting with Monday. And to do it, i used weekday function. But the result is not correct. I have tried all the options and these are the diffrent results i have: weekday([date], 1) ===> Friday 1, saturday 2 , sunday 3 weekday([date], 2) ===> saturday 1, sunday 2, monday 3 weekday([date], 3) ===> saturday 0, sunday 1, monday 2 and what i need is that the number of monday should be 1 , saturday 6 and suday 7 as described in the documentation here : https://learn.microsoft.com/fr-fr/dax/weekday-function-daxSolved10KViews0likes6CommentsDAX Calculate Countrows, average per Year per Weekday
Hello, I think I have a simple question but I can't figure out how to do it. I have a table in BI for example with a Date column and a column with the matching weekdays. There can be multiple equal dates because it's an order picking table. I would like to have that it counts the rows from the same Weekday and divide it by the matching dates. So when I have 6 rows in total on Mondays and these Mondays matches two dates, the calculation should be 6 / 2 Then my average = 3 (check table as example) What should be the correct DAX formula for this? Date Day of the week 2022-01-03 Monday 2022-01-03 Monday 2022-01-03 Monday 2022-01-03 Monday 2022-01-04 Tuesday 2022-01-04 Tuesday 2022-01-05 Wednesday 2022-01-05 Wednesday 2022-02-07 Monday 2022-02-07 Monday 2022-02-08 Tuesday 2022-02-09 Wednesday 2022-02-10 Thursday 2022-02-10 Thursday etc. etc. Average Countrows per Year per Weekday Result Calculation Monday 3 6 rows on Monday / 2 Dates Tuesday 1,5 3 rows on Tuesday / 2 Dates Wednesday 1,5 3 Rows on Wednesday / 2 Dates Thursday 2 2 Rows on Thursday / 1 Date With kind regards, Björn KoenenSolved4.4KViews0likes9Commentscalculate value for previous week of the month
hi everyone im trying to find week over week change for weeks of the month ex. if we are now in the month of FEB2022, weeks would be: W1: 1-2 till 5-2 W2: 6-2 till 12-2 W3:13-2 till 19-2 W4: 20-2 till 26-2 W5: 27-2 till 28-2 i want to calculate the week over week change and for that i need to find the value for previous week example with data: W1: 2478 W2: 3457 W3:3359 W4:3456 W5:574 week over week change for W2 would be (3457-2478)/2478=39.5Solved2KViews0likes3CommentsCount how many workdays that are from Min and Max value of the slicer
Hi there, I've been struggling with this one for a few days and wonder if someone can help. I have a slicer with a date dimension "created_date", and I'm looking to get the count of how many working days are between the min and max value of the "created_date". I've done two things: Created a column with: WorkWeekDays = IF(WEEKDAY(CASES[Weekdays])>=6,FALSE,TRUE) This works well: one the "weekdays" I have: Weekdays = WEEKDAY(CASES[created_date],2) Created a CCountWorkDays" measure with The calculation below: CountWorkDays = VAR FirstDay = CALCULATE(MIN('CASES'[created_date]), ALLSELECTED('CASES'[created_date])) VAR LASTDAY = CALCULATE(MAX('CASES'[created_date]), ALLSELECTED('CASES'[created_date])) var Weekdays = COUNTROWS(FILTER(CASES, CASES[WorkWeekDays] = FALSE())) RETURN DATEDIFF(FirstDay,LASTDAY,DAY) --- I realise I am not comparing it to the "Weekdays" var but haven't found a good way to do so. Any ideas?Solved4.1KViews0likes12Commentsfinding dates for weekday in the future
in our business we have a feature that lets users book a timeslot and weekday to recieve their service , for example ,user X booked his service to be every Friday 10:00 AM , user Y has booked his service to be every Tuesday 1:00 PM So user X will recieve his service every Friday 10:00AM and user Y will recieve his serive every Tuesday 1:00 PM the request is : create a matrix for every future date , how many users have booked a specific timeslot , ex: tuesady 06-29-2021 Wednesday 06-30-2021 Thursday 07-01-2021 Friday 07-02-2021 Saturday 07-03-2021 Sunday 07-04-2021 Monday 07-05-2021 tuesady 07-06-2021 Wednesday 07-06-2021 Thursday 07-07-2021 Friday 07-08-2021 10:00 AM 1 User 1 User 11:00 AM 12:00 PM 1:00 PM 1 User 1 User so as you can see , dates are in the futute , and do not exist in our database , the data i have is : -User ID -weekday -time -service date ( data will be shown once service date has passed , if the date hasnt come yet , data will be NULL) ex for the table : User ID Week day Time Serive date 124 Tusday 6:00 PM 6/27/2021 567 Friday 11:00 AM NULL 566 Sunday 4:00 PM NULL 433 Friday 3:00 PM NULL so how can i find for each weekday and time the date for it in the future evey month ?477Views0likes1CommentEOMONTH working days calculation
I have a measure to subtract the total number of days in a month e.g. 31 - absence. Measure = VAR _lastday = DAY ( EOMONTH ( DATE ( LEFT ( MAX ( 'DimDate'[Month Year] ), 4 ), VALUE ( RIGHT ( MAX ( 'DimDate'[Month Year] ), 2 ) ), 1 ), 0 ) ) RETURN IF ( ISBLANK ( [AbsentByDay] ), BLANK (), _lastday ) - [AbsentByDay] Is there a way to only include working days in this calculation e.g. 22 working days in month - absence? e.g. NOT WEEKDAY( 'DimDate'[Date] ) IN { 1,7 } File attached: https://www.dropbox.com/s/3oa7bx1rki1sl5j/Sample1%28updated%29.pbix?dl=0Solved2KViews0likes4CommentsSimple way to calculate working days between two dates.
Hi all, I've search all round this forum to find a simple solution to figure out number of working days between two dates. i.e. excluding weekend. I actually had to use two existing posts and some existing skills to make it a bit easier to understand. All dates in my example are hypothetical....Here it goes: Start with creating new table that will act as a calendar Next use this in formula bar of newly created table (you're giving it a name and it's first column) MyCalendar = CALENDAR(MIN('Activivty History'[Latest Baseline Dispatch Date].[Date]),MAX('Sub Project w Activities'[ACTUAL_START].[Date])) Explanation: CALENDAR funtion returns a table that contains a set of dates, it names your column simply as Date, whereas the usage of MIN and MAX indicates your date ranges of your date set. So I'm using MIN date found in Latest Baseline Dispatch Date column and MAX date found in Actual Start column. You should see something like this so far: Next we need to figure out week days within date range we just created. Create new column and copy and paste this: Week Day = WEEKDAY(MyCalendar[Date].[Date],2) As per documentation this function "Returns a number from 1 to 7 identifying the day of the week of a date". Syntax for this is: WEEKDAY(<date>, <return_type>). There are three different return types, read here more about it. I have used 2 in above code as it indicated week beggining on Monday (1) and ending on Sunday (7). You should now have something like this: You can see your 6 & 7 which is your Saturday and Sunday (feel free to check the calendar like I did to see if this was right) Next what you want to do is create a simple IF statement that determines if it's a working day or not, so use this: Working Day = IF(DimDate[Week Day] in {1,2,3,4,5},"True","False") This IF statement simply goes and checks what the week day is and if it falls within 1-5 range returns True otherwise it returns False. Now return to your table where you want to figure out your working days between two dates and do this: WorkingDays Early or Late = COUNTROWS( FILTER(MyCalendar, AND( AND( MyCalendar[Date].[Date] >='Activivty History'[Latest Baseline Dispatch Date].[Date], MyCalendar[Date].[Date] <=RELATED('Sub Project w Activities'[ACTUAL_START].[Date])), MyCalendar[Working Day]))) You're counting number of rows within filtered MyCalendar table you have created where your date range is (in my example) between Latest Baseline Dispatch Date and Actual Start and it only counts the ones that are True in Working Day calendar. Hope this helped someone out there! Thanks Kasia905Views0likes1CommentWeekday as DAX measure and not as calculated column
Hi, I have a fact table and a calendar table with date. I need to show weekday name (for e.g. 1st Jan is Monday) as DAX measure in pivot table and not a calculated column in calendar table. I have tried using FORMAT function, its working fine when i use it in calendar table but i need weekday as measure because i have already put "Date" in rows in pivot table. Please help. Regards Harish RathoreSolved3.2KViews0likes4Comments