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.
Could someone assist me to finish a M language date table to add fortnight. TIA
Here's what I have so far:
let
StartDate = #date(StartYear,1,1),
EndDate = #date(EndYear,12,31),
NumberOfDays = Duration.Days( EndDate - StartDate ),
Dates = List.Dates(StartDate, NumberOfDays+1, #duration(1,0,0,0)),
#"Converted to Table" = Table.FromList(Dates, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "FullDateAlternateKey"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"FullDateAlternateKey", type date}}),
#"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([FullDateAlternateKey]), type number),
#"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month", each Date.Month([FullDateAlternateKey]), type number),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Month", "Month Name", each Date.MonthName([FullDateAlternateKey]), type text),
#"Inserted Quarter" = Table.AddColumn(#"Inserted Month Name", "Quarter", each Date.QuarterOfYear([FullDateAlternateKey]), type number),
#"Inserted Fortnight" = Table.AddColumn(#"Inserted Fortnight", "Fortnight", each Date.StartOfFortnight([FullDateAlternateKey]), type number),
#"Inserted Week of Year" = Table.AddColumn(#"Inserted Quarter", "Week of Year", each Date.WeekOfYear([FullDateAlternateKey]), type number),
#"Inserted Week of Month" = Table.AddColumn(#"Inserted Week of Year", "Week of Month", each Date.WeekOfMonth([FullDateAlternateKey]), type number),
#"Inserted Day" = Table.AddColumn(#"Inserted Week of Month", "Day", each Date.Day([FullDateAlternateKey]), type number),
#"Inserted Day of Week" = Table.AddColumn(#"Inserted Day", "Day of Week", each Date.DayOfWeek([FullDateAlternateKey]), type number),
#"Inserted Day of Year" = Table.AddColumn(#"Inserted Day of Week", "Day of Year", each Date.DayOfYear([FullDateAlternateKey]), type number),
#"Inserted Day Name" = Table.AddColumn(#"Inserted Day of Year", "Day Name", each Date.DayOfWeekName([FullDateAlternateKey]), type text),
#"Renamed Columns1" = Table.RenameColumns(#"Inserted Day Name",{{"FullDateAlternateKey", "Date"}})
in
#"Renamed Columns1"
Solved! Go to Solution.
@agd50 , Create two columns like
You can use second argument to change the start of week day
#"Inserted Week Start date"
Week Start Date = Date.StartOfWeek([Date])
//Previous step table name used in List.Min
#"Inserted Fortnight"
=
let
_min = List.Min(#"Inserted Week Start date"[Week Start Date])
_quotient= Number.IntegerDivide(Duration.Days([Week Start Date]-_min),14)
_date = Date.AddDays(_min, _quotient*14)
in
_date
@agd50 , Create two columns like
You can use second argument to change the start of week day
#"Inserted Week Start date"
Week Start Date = Date.StartOfWeek([Date])
//Previous step table name used in List.Min
#"Inserted Fortnight"
=
let
_min = List.Min(#"Inserted Week Start date"[Week Start Date])
_quotient= Number.IntegerDivide(Duration.Days([Week Start Date]-_min),14)
_date = Date.AddDays(_min, _quotient*14)
in
_date
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
73 | |
71 | |
38 | |
29 | |
28 |
User | Count |
---|---|
99 | |
88 | |
62 | |
42 | |
39 |