Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
jdugas
Helper I
Helper I

Rolling 25 Months

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

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

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.

 

1.PNG

 

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")


2.PNG

 

If you have any other issue, please feel free to ask.

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

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.

 

1.PNG

 

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")


2.PNG

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.