Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I connect to a data set that is very heavy, so I have to limit each data import to the previous 30 days.
I do one data import for the previous 30 days this year using the standard date filters. I also want to do a separate data import for the same 30 days last year. It's the data import from last year that I haven't figured out how to do. Any suggestions?
Query 1 : 2022/11/08 - 2022/10/10
Query 2 : 2021/11/08 - 2021/10/10
Thank you!
Hi @Anders_G ,
What data source you are connecting to? Please check if Power Query Parameter can help you achieve the requirement.
1. Handle with filtering when load the data
Include Parameters within Power BI to Query a SQL Data Source
(x as text, y as text)=>let
Source = Sql.Database("x", "y", [Query="select *#(lf)from z#(lf)WHERE [period_number]="&P2&"#(lf)AND [fiscal_year]="&P1&""])
in
Source
2. Filter the rows after the data loaded
Using Query Parameters in Filter Rows
Best Regards
@Anders_G , You can get 4 dates like this in power query and use that to filter data
Date.From(DateTime.LocalNow())
Date.AddDays(Date.From(DateTime.LocalNow()),-30)
Date.AddYears(Date.From(DateTime.LocalNow()),-1)
Date.AddYears(Date.AddDays(Date.From(DateTime.LocalNow()),-30),-1)
Thank you. But where exactly do I add this?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
126 | |
78 | |
78 | |
59 | |
51 |
User | Count |
---|---|
165 | |
83 | |
68 | |
68 | |
59 |