Forum Discussion
FlyBoyNight
6 years agoNew Member
Direct Query - 2 Digit Month Insanity
Hi everyone, Really new to Power BI and Dax, so thanks in advance! I'm trying to get 2 digit month using Dax and Direct Query. Ultimately, I am trying to order data visuals correctly, using ...
- 6 years ago
YEAR and MONTH take Date as an argument, with your syntax it's just the number of days starting from 1899-12-31, where 2019 gives year 1905 and 4 gives 1 (January 1900)
You can use eitherDateofServiceYearMonth = RequestSummary[DateofServiceYear]*100 + RequestSummary[DateofServiceMonth]or
DateofServiceYearMonth = YEAR(RequestSummary[DateofService])*100 + MONTH(RequestSummary[DateofService])Personally I would use the first one
Stachu
6 years agoCommunity Champion
YEAR and MONTH take Date as an argument, with your syntax it's just the number of days starting from 1899-12-31, where 2019 gives year 1905 and 4 gives 1 (January 1900)
You can use either
DateofServiceYearMonth = RequestSummary[DateofServiceYear]*100 + RequestSummary[DateofServiceMonth]
or
DateofServiceYearMonth = YEAR(RequestSummary[DateofService])*100 + MONTH(RequestSummary[DateofService])
Personally I would use the first one
FlyBoyNight
6 years agoNew Member
Stachu,
Thank you so very, very much. I can't tell you how many hours I spent trying different iterations of other options. This is elegant and perfect for what I need.
Cheers!
- Stachu6 years agoCommunity Champion
glad to help 🙂