Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Praneeth19
Frequent Visitor

create a table in power query

trying to create a table in query similar to 

Praneeth19_0-1704057115436.png

the condition for this table is last 24 hours data but need it through power query not through dax as need to merge the data with different table

Praneeth19_1-1704057157483.png

the requirement is a bit urgent if any one knows solution please reply i tried this in power query was getting an error

let
MaxStartTime = List.Max(Sheet1[Start_Time]),
StartTime = DateTimeZone.ToLocal(DateTime.From(DateTime.Date(MaxStartTime)) - #duration(23, 0, 0)),
EndTime = DateTimeZone.ToLocal(DateTime.From(DateTime.Date(MaxStartTime)) + #duration(23, 0, 0)),
GenerateSeries = List.Generate(
() => StartTime,
each _ <= EndTime,
each _ + #duration(0, 1, 0)
),
AddEndColumn = Table.FromList(GenerateSeries, Splitter.SplitByNothing(), {"Start Time"}),
AddEndColumnWithType = Table.AddColumn(AddEndColumn, "End Time", each [Start Time] + #duration(0, 1, 0))
in
AddEndColumnWithType

the errer was 
Expression.Error: 3 arguments were passed to a function which expects 4.
Details:
Pattern=
Arguments=[List]

2 REPLIES 2
Fowmy
Super User
Super User

@Praneeth19 

Please try this code, I modified the Generate func as well:

let
    MaxStartTime =  List.Max(Sheet1[Start_Time]),
    StartTime = DateTimeZone.ToLocal(DateTime.From(DateTime.Date(MaxStartTime)) - #duration(23, 0, 0, 0)),
    EndTime = DateTimeZone.ToLocal(DateTime.From(DateTime.Date(MaxStartTime)) + #duration(23, 0, 0, 0)),
    GenerateSeries = List.Generate(
        () => StartTime, 
        each _ <= EndTime,
        each _ + #duration(0, 1, 0 , 0),
        each _  
    ),
    AddEndColumn = Table.FromList(GenerateSeries, Splitter.SplitByNothing(), {"Start Time"}),
    AddEndColumnWithType = Table.AddColumn(AddEndColumn, "End Time", each [Start Time] + #duration(0, 1, 0, 0))
in
    AddEndColumnWithType



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

spinfuzer
Solution Sage
Solution Sage

#duration needs 4 arguments #duration(day,hour,min,sec)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors