Forum Discussion
Creating a custom column to filter data
DAX formula you can use for the new column:
Status =
IF(
'YourTable'[Category] = "Category B" &&
'YourTable'[Date] < EDATE(TODAY(), -24),
"Exclude",
"Include"
)
You can now apply a visual-level filter or page-level filter to show only rows where Status is "Include".
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
- PPStar1 year agoHelper V
Hello.
This gives me an error,
Expression.Error: The import IF matches no exports. Did you miss a module reference?
DetailsReason = Expression.Erroralso what is the EDATE?
- Angith_Nair1 year agoContinued Contributor
Use this DAX formula:
Status = IF( TableName[Category] = "Category B" && TableName[Date] < TODAY() - 730, "Exclude", "Include" )TODAY() - 730 dynamically calculates a 2-year range by subtracting 730 days from today’s date.
You can then filter your data based on the "Exclude" or "Include" status in the newly created column.
- Anonymous1 year agoNot applicable
Hi PPStar ,
Check to make sure you are copying the dax code provided by Kedar_Pande correctly, it should work fine.'' Edate' function works better for your needs, if you simply use 'Today - 720', you may get an error because leap year has 366 days.
Column = IF([_category] = "B" && [Date] < EDATE(TODAY(),-24) ,"exclude","include")Best Regards,
Wenbin Zhou