Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a table of "Matters" with a Status column designating whether the Matter is "Open" or "Closed". There is also a StatusDate column showing the date the Status was set.
I want to filter out Matters where the status=Closed and the StatusDate<1/1/2020.
I have tried this, but get the error: "Expression.Error: We cannot apply operator < to types Number and Date."
= Table.SelectRows(#"Filtered Rows3",each ([Status]="Closed" and [StatusDate]<1/1/2020))
Thanks for any help.
Solved! Go to Solution.
Looks like my brute force approach (try everything until something works) has worked again:
= Table.SelectRows(#"Filtered Rows3", each ([StatusDate]>#date(2020,1,1) and [Status]="Closed") or [Status]="Open" or [Status]="Active")
Change your original formula to :
Table.SelectRows(#"Filtered Rows3",each ([Status]="Closed" and [StatusDate]<#date(2020,1,1))
Power Query doesn't understand 1/1/2020 in a filter. It has to use the #date() function, or refer to a column or variable that has the data type date set.
The error is your StatusDate is a date, and 1/1/2020 is a formula dividing 1 by 1 by 2020, and you cannot compare dates to numbers.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingChange your original formula to :
Table.SelectRows(#"Filtered Rows3",each ([Status]="Closed" and [StatusDate]<#date(2020,1,1))
Power Query doesn't understand 1/1/2020 in a filter. It has to use the #date() function, or refer to a column or variable that has the data type date set.
The error is your StatusDate is a date, and 1/1/2020 is a formula dividing 1 by 1 by 2020, and you cannot compare dates to numbers.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingLooks like my brute force approach (try everything until something works) has worked again:
= Table.SelectRows(#"Filtered Rows3", each ([StatusDate]>#date(2020,1,1) and [Status]="Closed") or [Status]="Open" or [Status]="Active")
This 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 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |