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.
I have a datedim table and I want to add a column that will tell me if that date is between TODAY() and MONTH(TODAY())-25. I'm looking for a rolling 25 month range.
Thanks
Solved! Go to Solution.
Hi @jdugas,
For your requirement, you’d better create a calendar table between TODAY() and MONTH(TODAY())-25. For instance, if today is 2017/1/6, you will create a calendar during 204/12/6-2015/1/6. Then get the minimum date form the calendar table to judge the date if in the range. I try to reproduce your scenario and get expected result.
First I try to create my sample data as follows.
TODAY() is 2016/1/6, so I create Calendar table using the formula: Calendar = CALENDAR(DATE(2014,12,6),DATE(2017,1,6))
Then create a calculated column to get the expected result using the formula below. “MINX('Calendar','Calendar'[Date])” returns “MONTH(TODAY())-25” date. It will display “Yes” if the date is in the range, and it displays “No” oppositely.
Result = IF(AND(Table3[Date]<=TODAY(),Table3[Date]>MINX('Calendar','Calendar'[Date])),"Yes","No")
If you have any other issue, please feel free to ask.
Best Regards,
Angelia
Hi @jdugas,
For your requirement, you’d better create a calendar table between TODAY() and MONTH(TODAY())-25. For instance, if today is 2017/1/6, you will create a calendar during 204/12/6-2015/1/6. Then get the minimum date form the calendar table to judge the date if in the range. I try to reproduce your scenario and get expected result.
First I try to create my sample data as follows.
TODAY() is 2016/1/6, so I create Calendar table using the formula: Calendar = CALENDAR(DATE(2014,12,6),DATE(2017,1,6))
Then create a calculated column to get the expected result using the formula below. “MINX('Calendar','Calendar'[Date])” returns “MONTH(TODAY())-25” date. It will display “Yes” if the date is in the range, and it displays “No” oppositely.
Result = IF(AND(Table3[Date]<=TODAY(),Table3[Date]>MINX('Calendar','Calendar'[Date])),"Yes","No")
If you have any other issue, please feel free to ask.
Best Regards,
Angelia
OK. Thanks for this update.
I'm not sure how I would create a calendar from a moving date. For example I always want to calculate the "Rolling 25 Months" from the "Last Full Month". I don't think your solution gets me there, unless I'm missing something.
Thanks
Jeremy
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 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |