March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
Please see the example table below. All I need to do is create a calculated column where within each cell a "Yes" will be polulated if the Date is within 30 days of today and a "No" will be populated if the date is not within 30 days of today. Please note that the data model I'm working with does not have a date table. I'm pretty sure that I need to use an IF statement along with the Today() function and have a 30 in there somewhere.
Thanks in advance to anyone who can help!
Project ID | Date |
1 | 4/1/2020 |
2 | 3/30/2020 |
3 | 5/1/2020 |
4 | 6/1/2020 |
Solved! Go to Solution.
The code I posted earlier actually does work. Thanks for helping me get there.
Within 30 Days of Start Date = IF('Table'[Start Date].[Date]>= TODAY(),IF('Table'[Start Date].[Date] <=TODAY()+30, "Within 30 Days of Start Date","No"))
Hi @Anonymous ,
You could use ABS() function to return absolute value.
Column =
IF ( ABS ( DATEDIFF ( TODAY (), 'Table'[Date], DAY ) ) <= 30, "yes", "no" )
Hi @Anonymous
try a column
Column = IF(TODAY()-30 <= [Date], "yes", "no")
Thank you. I'm thinking it would be Column =IF(TODAY()+30 <= [Date],"Yes","No")
Adding 30 days to today instead of subtracting. Thoughts?
@Anonymous
it depends on what do you mean "within" 🙂 within plus, within minus or within +/- 30 days 🙂
I'm almost there. The below expression filters a table on projects with start dates beginning today or after today (as opposed to including projects with start dates prior to today), but it is also including projects with start dates beyond 30 days from today. I tried including AND at different points within the expression but can't get it to cooperate.
@Anonymous
so, does your statement work? try without .[Date] like
Within 30 Days of Start Date = IF('Table'[Start Date] >= TODAY() && 'Table'[Start Date] <= TODAY()+30, "Within 30 Days of Start Date","No"))
My statement is working in that it filters on projects with start dates beginning today or after, but it's not truncating the list if start dates are greater than 30 days from today.
Your latest expression isn't working unfortunately. It pulls in start dates both prior to today and after 30 days...
@Anonymous
I did check it with my dummy data. it works as appropriated
Are the semi colons in your code significant? I'm not able to use them...
The code I posted earlier actually does work. Thanks for helping me get there.
Within 30 Days of Start Date = IF('Table'[Start Date].[Date]>= TODAY(),IF('Table'[Start Date].[Date] <=TODAY()+30, "Within 30 Days of Start Date","No"))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |