Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
smithD0
Frequent Visitor

Adding Day of the Week value to Calendar Table formula only shows Saturday or Sunday values

I'm using the following formula to create a Date Table.  Everything shows up appropriately, until I add the Day of the week numbering, at which time, I only see Saturdays or Sundays.  I've created a new table that has dedicated column formulas for the day of the week entries, and that works without issue.  Is there something wrong with adding them all to a single calculated table that would only display a single day?

 

Calendar =
ADDCOLUMNS (
CALENDAR (DATE(2000,1,1), DATE(2025,12,31)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", FORMAT(WEEKDAY ( [Date] ), "00"),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ))

1 ACCEPTED SOLUTION

@smithD0,

 

I'm sorry, I guess I do not fully understand your issue then. When I copy paste your code I get the following when I sort:

 

3.PNG

 

To me, it seems that I am getting the expected DayOfWeek.

 

Possibly posting your actual data and your expected outcome could help someone else provide insight.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

6 REPLIES 6
ChrisMendoza
Resident Rockstar
Resident Rockstar

hello @smithD0, my guess is that because you're using FORMAT( ) which returns  "A string containing value formatted as defined by format_string." you're getting unintended results.

 

Are you required to make your Calendar Table in this method, or are you allowed other options?

 

edit - So I actually didn't see any data when I first copied your DAX until it finally appeared. And then I saw what you described wher e you could only see Sat/Sun. One of the first things I noticed after that was that the column [Date] was unsorted. I sorted ascending and now I see the [DayOfWeek] as I believe you had hoped.

 

Try sorting your [Date] ascending.

 

1.PNG






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



@ChrisMendoza

 

If I remove the FORMAT from the WEEKDAY formula, the result ends up being the same.  I have verified that I'm sorting via Date Ascending.

image.png

 

 

Sort the [Date] column. July 2, 9, 16, & 23 were all Sundays in 2000. Where is the 3rd - 8th in the table and what does your DayOfWeek reflect for those?

 

medium.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



That's the issue, they are removed when I add any of the formulas that calculate out the day of the week.  So when I add in the Day of the Week name, short name and date of the week number, I only get Sundays as a result.  Without those formulas, I get all of the days in order through CALENDAR().

@smithD0,

 

I'm sorry, I guess I do not fully understand your issue then. When I copy paste your code I get the following when I sort:

 

3.PNG

 

To me, it seems that I am getting the expected DayOfWeek.

 

Possibly posting your actual data and your expected outcome could help someone else provide insight.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



That did it!  I had to sort ascending.  Thank you.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.