Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a table with a column of Month NUmber and a column for Year. I want to make a date column for the 1st of the month. The new column I want to be formatted [Month Number]/1/[Year]
Example: the second row is February 2021. I want the new date column to look like 2/1/2021.
Solved! Go to Solution.
@DSwezey this was to be done in PQ.
For DAX use this
Column = DATE('Table'[Year],'Table'[Month Number],1)
@DSwezey this was to be done in PQ.
For DAX use this
Column = DATE('Table'[Year],'Table'[Month Number],1)
Here for the last date or maximum date, I want the last day of month instead of first day, eg if my data lies between Jan 2023 to Jan 2024, I want all records between Jan 2023 to Dec 2023 to show date for first day of month(MMM/01/YYYY) except the records having date in Jan 2024 which I want to show as last day of month(01/31/2024).
I don't want the enddate for all the records, only for the records having last(latest) month and year.
For future requests, provide sample data as table so we can copy/paste (see note below my comment) and expected result based on sample data please.
Result
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRU0lEyMjAyVorVAfKMUHgQjgmYYwTnxAIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, Year = _t]),
Ad_Date = Table.AddColumn(Source, "Date", each #date(Number.From([Year]),Number.From([Month]),1), type date),
MaxDate = List.Max(Ad_Date[Date]),
ReplaceMaxDate = Table.TransformColumns(Ad_Date, {{"Date", each if _ = MaxDate then Date.EndOfMonth(MaxDate) else _, type date}})
in
ReplaceMaxDate
Thanks
@DSwezey create a new column as
#date([Year],[Month Number],1)
and then format as you wish through DAX
I get this error when adding the custom column.
date <> #date
change
date([Year],[Month Number],1)
to (as written by @smpa01 )
#date([Year],[Month Number],1)
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.