calendar()
6 TopicsHow to remove weeks from calendar
Hi all, I have the following DAX code to generate a calendar. DimDates = VAR BaseCalendar = CALENDAR(DATE(2022,1,1), TODAY()) RETURN GENERATE( BaseCalendar, VAR BaseDate = [Date] VAR YearDate = YEAR(BaseDate) VAR Week = WEEKNUM(BaseDate,2)-1 RETURN ROW ( "Year",YearDate, "YearMonth",FORMAT(BaseDate,"yyyy-mm"), "Quarter", FORMAT(BaseDate, "\Quarter q"), "Weeknumber",WEEKNUM (BaseDate,2), "YearWeeknumber", FORMAT(BaseDate,"yyyy") &"-"& FORMAT(WEEKNUM (BaseDate,2),"00"))) My question is, how can I update this code to remove YearWeekNumber 2022-53 and 2023-53? Thank you for your answers! LRSolved624Views0likes2CommentsCustom Calendar fiscal year october
i want to create a day number on DAX Calendar. we have a custom calendar for fiscal year, our fiscal year stars on october 1 and i want to create a column when day #1 are october first, 2 october second... could you please help?, i alredy try trhu date dif: daynum#FIX = DATEDIFF ( DATE ( YEAR ('Calendario End Date'[Date]),10,1 ), 'Calendario End Date'[Date], DAY ) + 1 but when function comes to 1jan retun -273 thanks in advance for the helpSolved1.1KViews0likes5CommentsDAX Cookbook "Determine day and working day numbers"
Hi everyone, hi Greg, I got your book "Dax cookbook" and am going to go through it, all 520 pages (great book, love it! I failed on the Italian's "Definitive DAX Guide"). I am not totally new with PBI and DAX, around 2 years of experience, but complex DAX is still hard stuff for me, so as this challenge. I went to the mentioned chapter (page 55), got it going but I am not sure about the result. I would expect the outcome should be the count of ONLY the working days of a calendar year, ignoring Sat and Sun (means weekday([date],2) <6), bc I am from Germany), which totals to 262 days in 2020. Then the calculation should repeat for 2021 giving the number of workdays for that year and so on. I realized the first part with the following DAX. _Workdaycheck = if(WEEKDAY(R04_Calendar[Date],2) <6,1,0) _Workdayearlier = SUMX(FILTER(R04_Calendar,'R04_Calendar'[Date]<=EARLIER('R04_Calendar'[Date])),R04_Calendar[_Workdaycheck]) This gives me the count of the working days ignoring Sat and Sun in the calendar and works perfectly for one year e.g. I filter the table to 2020. But I could not solve the problem, that it keeps counting over the 31/12/2020, while it actually should restart counting on Jan 1st. Expected result date weekday weekdaycheck working days 26/12/2020 Sat 0 257 27/12/2020 Sun 0 258 28/12/2020 Mon 1 259 29/12/2020 Tue 1 260 30/12/2020 Wed 1 261 31/12/2020 Thr 1 262 01/01/2021 Fri 1 1 02/01/2021 Sat 0 03/01/2021 Sun 0 04/01/2021 Mon 1 2 05/01/2021 Tue 1 3 The result in the book looks much different, so I am wondering, whether I am doing something wrong and how I can solve the problem to restart the counting cycle. Any idea is highly appreciated. Greg_Deckler See you guys BenediktSolved1.1KViews0likes2CommentsDate Table - DAX - CALENDAR() - ADDCOLUMNS() - Quarter Issue
Hi, I create a new Date table with DAX using the CALENDAR() function. Adding new columns, no problem. When I add a new "Quarter" colum into the table my table stops starting from Jan 1st and move to start from Jul 1st. I can't understand why. Any help greatly appreciated. First Variant (correct) Date = VAR MinDate = DATE(2016,1,1) VAR MaxDate = DATE(2021,12,31) RETURN ADDCOLUMNS ( CALENDAR(MinDate, MaxDate), "Calendar Year", "CY " & YEAR ([Date]) ) Result Second Variant (wrong) Date = VAR MinDate = DATE(2016,1,1) VAR MaxDate = DATE(2021,12,31) RETURN ADDCOLUMNS ( CALENDAR(MinDate, MaxDate), "Calendar Year", "CY " & YEAR ([Date]), "Calendar Quarter", "CQ " & QUARTER([Date]) ) Result Where I am wrong? ThanksSolved13KViews0likes4CommentsDetermine the number of business / workdays in the current month & previous month
I am trying to determine the number of business / workdays in the current month & the previous month. I have a "Production" Fact Table on my dashboard with a period of 2 years. I would also like to be able to do the following : 1) Determine the number of business / workdays in the current month & the previous month. 2) Allow the number of business / workdays in the current month & the previous month to change according to the selected "Production" date. (not compulsary) 3) Incorporate manual input of holidays possibly in sharepoint (yet to decide how) into the calculation of number of business / workdays in the current month & the previous month based on selected date. What i have done so far : 1. Create a table : Workday Calendar = CALENDAR(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-2+2)) **note that this table do not have every single date in current month. (that's why i created a custom table) 2. Add Column to determine Day of the week : Day = FORMAT('Workday Calendar'[Date],"dddd") 3. Add measure Current Month Workdays = CALCULATE(COUNT('Workday Calendar'[Date]),'Workday Calendar'[Day] <> OR("Saturday","Sunday"),MONTH('Workday Calendar'[Date])=MONTH(TODAY())) Why this did NOT work : 1) No relationship / connection with current model. Final measures will be able to determine : (1) to multiply "average daily current month estimate" * "number of current month working days" = current month production estimate (2) "number of previous month working days"Solved1.1KViews0likes2Comments