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 need to import a table from a SQL Server Database in Azure.
Let say this tabel, called Table contains 3 columns: ID, Date, Name
Example:
In this example is the maximum date is: 19/08/2020
All records with a date before the maximum date minus 30 days have to be filtered out.
Result:
Important to know is that the refresh of the data at random and the maximum date will change every refresh.
In the import query I can add filtered rows step
= Table.SelectRows(#"Changed Type", each ([Date] <> #date(2020, 7, 1) and [Date] <> #date(2020, 7, 😎 and [Date] <> #date(2020, 7, 15)))
Or with the Advanced Editor I get the expression:
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] <> #date(2020, 7, 1) and [Date] <> #date(2020, 7, 😎 and [Date] <> #date(2020, 7, 15)))
But this is not dynamic and the next time a refresh is executed, I will have too many records.
I should have an expresion that looks like:
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] >= DATEADD(MAX([Date]),-30,day)))
But DATEADD and MAX are not excepted here.
So how should I solve this?
Thanks
R.W.
Solved! Go to Solution.
Thanks,
It's part of the solution.
It made me find the whole solution:
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] >= Date.AddDays(List.Max(#"Changed Type"[Date]), -30)))
R.W.
@Anonymous , Not very clear to me
In case of power query you have Date.AddDays in place od DAX dateadd
https://docs.microsoft.com/en-us/powerquery-m/date-adddays
Thanks,
It's part of the solution.
It made me find the whole solution:
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] >= Date.AddDays(List.Max(#"Changed Type"[Date]), -30)))
R.W.
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 |
---|---|
114 | |
97 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |