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.
what is the most efficient way to limit the dates in the date table in power query.
I am pulling all my tables from the datawarehouse via sql. I want to limit the dim date dynamically by only including data for the last 4 years, so that 3 years historical and 1 year ahead because i have a lot of rows in that table.
What is the best way to do this?
tia!
Proud to be a Super User!
Solved! Go to Solution.
Hi,
There are two ways to do this.
1. Create a view in the Data Warehouse. Then we can connect to the view from Power BI. Maybe it looks like this:
create view FourYears as select * from daxbook.Date where [Calendar Year Number]<=year(getdate())-4;
2. Edit the query of Power BI in Advanced Editor. Maybe it looks like this:
let Source = Sql.Database("DB", "contosoretaildw", [Query="select * from daxbook.Date where [Calendar Year Number]<=year(getdate())-4;"]) in Source
Please have a try.
Best Regards!
Dale
Hi @vanessafvg,
Could you please mark the proper answer or share your answers if it's convenient for you? That will be a help to others.
Best Regards!
Dale
Hi,
There are two ways to do this.
1. Create a view in the Data Warehouse. Then we can connect to the view from Power BI. Maybe it looks like this:
create view FourYears as select * from daxbook.Date where [Calendar Year Number]<=year(getdate())-4;
2. Edit the query of Power BI in Advanced Editor. Maybe it looks like this:
let Source = Sql.Database("DB", "contosoretaildw", [Query="select * from daxbook.Date where [Calendar Year Number]<=year(getdate())-4;"]) in Source
Please have a try.
Best Regards!
Dale
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 |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
107 | |
105 | |
87 | |
61 |