Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 136 | |
| 102 | |
| 68 | |
| 66 | |
| 58 |