Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I'd like to filter my source data to show me all records up to the current week, but not including the current week. I've tried adding a custom column where I create a "Today Week" by doing:
= Table.AddColumn(#"Added Custom2", "Week (Today)", each Date.WeekOfYear(DateTime.LocalNow()))
AND
= Table.AddColumn(#"Merged Columns", "Year (Today)", each Date.Year(DateTime.LocalNow()))
Then joining the two fields together, but I'm not seeing how I could then filter my existing year week by this?
Additionally, the formatting gets skewed on the week for when it's single digits - if this was the path to go down, how to I pad it with an extra leading 0 where it's a week number less than 10?
Many thanks for your help,
Dayna
Solved! Go to Solution.
Hi, @Dayna
1.As a workaround, you might consider adding an extra column or a parameter 'Start of week' to get the start date of the current week
=Table.AddColumn(#"Added Custom", "Start of Week(Today)", each Date.StartOfWeek(DateTime.LocalNow()))
and then filter all data with dates less than the start date of the current week.
= Table.SelectRows(#"Inserted Start of Week", each [Date] < Date.StartOfWeek(DateTime.LocalNow()))
Here you need to confirm that the data types of the columns are the same(Date/Time)
2.You can try Text.PadStart to format the WeekOfYear.
=Table.AddColumn(#"Inserted Week of Year1", "New week of Year", each Text.PadStart(Text.From([Week of Year], "en-US"), 2, "0"), type text)
Best Regards,
Community Support Team _ Eason
Hi, @Dayna
1.As a workaround, you might consider adding an extra column or a parameter 'Start of week' to get the start date of the current week
=Table.AddColumn(#"Added Custom", "Start of Week(Today)", each Date.StartOfWeek(DateTime.LocalNow()))
and then filter all data with dates less than the start date of the current week.
= Table.SelectRows(#"Inserted Start of Week", each [Date] < Date.StartOfWeek(DateTime.LocalNow()))
Here you need to confirm that the data types of the columns are the same(Date/Time)
2.You can try Text.PadStart to format the WeekOfYear.
=Table.AddColumn(#"Inserted Week of Year1", "New week of Year", each Text.PadStart(Text.From([Week of Year], "en-US"), 2, "0"), type text)
Best Regards,
Community Support Team _ Eason
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |