Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello everyone,
I got this [Date] column and I would like to filter it but conditionally, if today is Monday so I need it to filter [Date] to keep only Sunday’s, Saturday’s and Friday’s entries that preceded today only, otherwise, to filter [Date] to keep only yesterday’s entries, how to do that?
Another question related to data models in excel, is there a way to load them in tables, not power pivot?
Solved! Go to Solution.
Add a new blank query and go to the advanced editor. Delete all the code and paste this in:
let
Source = if Date.DayOfWeek(DateTime.LocalNow(), Day.Monday) = 0 then Date.AddDays(DateTime.Date(DateTime.LocalNow()), -3) else Date.AddDays(DateTime.Date(DateTime.LocalNow()), -1)
in
Source
If today is Monday, it will return a day 3 days in the past, otherwise 1 day in the past.
Call this query varDate. Set it not to load.
Now, go to your data and filter for any day to get the filter to work. Remove whatever date you selected (it might say #date(2022,3,25) - remove that code and use varDate.
It might look like this:
Table.SelectRows(#"Added Custom", each ([Dates] = varDate))
On the 2nd question, no. You can create a flat pivot table, but not a pure table. Those must come direclty from Power Query, not Power Query to Power Pivot then down to and Excel sheet.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingAdd a new blank query and go to the advanced editor. Delete all the code and paste this in:
let
Source = if Date.DayOfWeek(DateTime.LocalNow(), Day.Monday) = 0 then Date.AddDays(DateTime.Date(DateTime.LocalNow()), -3) else Date.AddDays(DateTime.Date(DateTime.LocalNow()), -1)
in
Source
If today is Monday, it will return a day 3 days in the past, otherwise 1 day in the past.
Call this query varDate. Set it not to load.
Now, go to your data and filter for any day to get the filter to work. Remove whatever date you selected (it might say #date(2022,3,25) - remove that code and use varDate.
It might look like this:
Table.SelectRows(#"Added Custom", each ([Dates] = varDate))
On the 2nd question, no. You can create a flat pivot table, but not a pure table. Those must come direclty from Power Query, not Power Query to Power Pivot then down to and Excel sheet.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThis is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
10 | |
10 | |
8 | |
7 |