Is there a Power Query version of the excel formula WORKDAY?
I need to filter a report based on the previous working day, and I can use 'Day>Yesterday' in the filter options, however, if the report is run on a Monday this will show Sunday when it needs to show the Friday.
=workday(today(),-1) does this but I can't see a Power Query version.
Using the search term "excel power query workday function" I got some results from the Microsoft Fabric Community that may be helpful although I have not personally tested them.
Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
cType = Table.TransformColumnTypes(Source,{{"Val", Int64.Type}, {"Date", type date}}),
getPrevWorkDay = (varDate as date) =>
let
wkDay = Date.DayOfWeek(varDate, 0),
prevWorkDay = Date.AddDays(varDate, {-2,-3,-1,-1,-1,-1,-1}{wkDay} )
in
prevWorkDay,
result = Table.SelectRows(cType, each [Date] = getPrevWorkDay(Date.From(DateTime.FixedLocalNow())))
in
result
Bookmarks