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 M Query experts, I'm looking for a little help please. I need to filter a column, based on the month end date of the prior month MINUS one year. So, for example, if today is Nov 14, 2019, I want to filter on the date Oct 31,2018. I tried the following, but am getting the error below:
= Table.SelectRows(#"Filtered Rows", each [Contract End Date] >=
(Date.AddYears(Date.EndOfMonth(Date.AddMonths(DateTime.LocalNow()), -1))), -1)
Expression.Error: 3 arguments were passed to a function which expects 2.
Details:
Pattern=
Arguments=[List]
I keep moving around the () and the comma, but still receive errors. What am I missing? Thanks for the help!
@Anonymous, @v-chuncz-msft
Solved! Go to Solution.
I think you've just got some parentheses in the wrong places. I haven't tested this in a real query yet, but I think what you want is:
Table.SelectRows(#"Filtered Rows", each [Contract End Date] >=
(Date.AddYears(Date.EndOfMonth(Date.AddMonths(DateTime.LocalNow(), -1)), -1)))
Proud to be a Super User!
Hi @Shelley
It is easy with DAX in data model.
Create a calculated column
filter date =
DATE ( YEAR ( EOMONTH ( TODAY (), -1 ) ) - 1, MONTH ( EOMONTH ( TODAY (), -1 ) ), DAY ( EOMONTH ( TODAY (), -1 ) ) )
What @KHorseman said. I just want to add that the right side of the argument will return DateTime format so you might need to encapsulate it within Date.From function to convert it into Date format for comparision, assuming your Contract End Date is in Date format.
I think you've just got some parentheses in the wrong places. I haven't tested this in a real query yet, but I think what you want is:
Table.SelectRows(#"Filtered Rows", each [Contract End Date] >=
(Date.AddYears(Date.EndOfMonth(Date.AddMonths(DateTime.LocalNow(), -1)), -1)))
Proud to be a Super User!
This looks like something I need help with,
I am looking for something similar for Power Querry Editor but for everying before the previous month.
I have tried to make changes to this formula but being a novice I cant see to get it to work
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |