March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have created a date table using DAX ...
Solved! Go to Solution.
@duncanwil
You can use the right function (WEEKNUM) to extract the week number than the FORMAT function. Use the following calendar table code. it should work for you.
Dates =
VAR StartYear = 2020
VAR EndYear = 2021
VAR DatesColumn =
CALENDAR(
DATE(StartYear , 1 , 1),
DATE(EndYear, 12 , 31)
)
RETURN
ADDCOLUMNS(
DatesColumn,
"Month No" , MONTH([Date]),
"Month Name" , FORMAT( [Date] , "Mmmm" ),
"Year" , YEAR([Date]),
"Month Year No" , (YEAR([Date]) * 100) + MONTH([Date]),
"Month Year" , FORMAT( [Date] , "Mmm yyyy"),
"Quarter" , QUARTER([Date]),
"Qtr Name" , FORMAT( [Date] , "\QQ"),
"Week Day" , WEEKDAY([Date],2),
"Week" , FORMAT( [Date] , "Dddd" ),
"Week No" , WEEKNUM([Date],2),
"Week Num" , "WK - " & WEEKNUM([Date],2)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thank you both. I have to confess that I had read those pages/suggestions but my lack of DAX experience led me to assume FORMAT was OK.
So, I repgrammed to use WEEKNUM and so on and the tables are behaving as expected.
Duncan
Detailed reference
https://docs.microsoft.com/en-us/dax/format-function-dax
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@duncanwil
You can use the right function (WEEKNUM) to extract the week number than the FORMAT function. Use the following calendar table code. it should work for you.
Dates =
VAR StartYear = 2020
VAR EndYear = 2021
VAR DatesColumn =
CALENDAR(
DATE(StartYear , 1 , 1),
DATE(EndYear, 12 , 31)
)
RETURN
ADDCOLUMNS(
DatesColumn,
"Month No" , MONTH([Date]),
"Month Name" , FORMAT( [Date] , "Mmmm" ),
"Year" , YEAR([Date]),
"Month Year No" , (YEAR([Date]) * 100) + MONTH([Date]),
"Month Year" , FORMAT( [Date] , "Mmm yyyy"),
"Quarter" , QUARTER([Date]),
"Qtr Name" , FORMAT( [Date] , "\QQ"),
"Week Day" , WEEKDAY([Date],2),
"Week" , FORMAT( [Date] , "Dddd" ),
"Week No" , WEEKNUM([Date],2),
"Week Num" , "WK - " & WEEKNUM([Date],2)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |