Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello All,
Need help in excluding weekend dates from a date column in power query editor.
Thanks in Advance
Solved! Go to Solution.
Here's the simple version.
See below and attached. Basically, add a DayOfWeekName column based on your date and filter from there.
let
start = Number.From(#date(2021, 1, 1)),
end = Number.From(#date(2021, 12, 31)),
Source = {start .. end},
#"Converted to Table" = Table.FromList(
Source,
Splitter.SplitByNothing(),
null,
null,
ExtraValues.Error
),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table", {{"Column1", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type", {{"Column1", "Date"}}),
#"Inserted Day Name" = Table.AddColumn(
#"Renamed Columns",
"Day Name",
each Date.DayOfWeekName([Date]),
type text
),
#"Filtered Rows" = Table.SelectRows(
#"Inserted Day Name",
each ([Day Name] <> "Saturday" and [Day Name] <> "Sunday")
)
in
#"Filtered Rows"
Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
If you found this post helpful, please give Kudos. It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen. If you find my signature vaguely amusing, please give Kudos. | Proud to be a Super User! |
Here's the simple version.
See below and attached. Basically, add a DayOfWeekName column based on your date and filter from there.
let
start = Number.From(#date(2021, 1, 1)),
end = Number.From(#date(2021, 12, 31)),
Source = {start .. end},
#"Converted to Table" = Table.FromList(
Source,
Splitter.SplitByNothing(),
null,
null,
ExtraValues.Error
),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table", {{"Column1", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type", {{"Column1", "Date"}}),
#"Inserted Day Name" = Table.AddColumn(
#"Renamed Columns",
"Day Name",
each Date.DayOfWeekName([Date]),
type text
),
#"Filtered Rows" = Table.SelectRows(
#"Inserted Day Name",
each ([Day Name] <> "Saturday" and [Day Name] <> "Sunday")
)
in
#"Filtered Rows"
Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
If you found this post helpful, please give Kudos. It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen. If you find my signature vaguely amusing, please give Kudos. | Proud to be a Super User! |
@Anonymous
Networkdays, please see below link:
https://www.thebiccountant.com/2020/02/20/date-networkdays-function-for-power-query-and-power-bi/
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |