This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
So i have a column of dates and i want to add a column which contains a formula saying if that data is before today then "yes" else "no"
when you do the conditional column and say before you can put a date but not TODAY() How do i replace 2121, 1, 1 with TODAY() ?
= Table.AddColumn(#"Renamed Columns", "Custom", each if [#"Expiry"] <= #date(2021, 1, 1) then "Expired" else "Not-Expired")
Solved! Go to Solution.
Greg is right - to be specific, change your formula to this
Table.AddColumn(#"Renamed Columns", "Custom", each if [#"Expiry"] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Not-Expired")
DateTime.LocalNow() is equivalent to NOW() in Excel.
Wrapping it in DateTime.Date() converts it to just the day - strips the time off of it, so it will do the comparison correctly.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingIn Power Query? You could group by the new column and use COUNT as the aggregation, but I'd be inclined to that in DAX, as that is analysis. So
Expired Count =
CALCULATE(
COUNTROWS( MyTable ),
MyTable[ExpiredField] = "Expired"
)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingGreg is right - to be specific, change your formula to this
Table.AddColumn(#"Renamed Columns", "Custom", each if [#"Expiry"] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Not-Expired")
DateTime.LocalNow() is equivalent to NOW() in Excel.
Wrapping it in DateTime.Date() converts it to just the day - strips the time off of it, so it will do the comparison correctly.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThis is great thanks how would i go about counting rows of expired and non expired from there then please ?
In Power Query? You could group by the new column and use COUNT as the aggregation, but I'd be inclined to that in DAX, as that is analysis. So
Expired Count =
CALCULATE(
COUNTROWS( MyTable ),
MyTable[ExpiredField] = "Expired"
)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThank you
@Jay2077 You are mixing DAX and M. In M you would use something like DateTime.LocalNow()
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |