Forum Discussion

ScholesBI's avatar
ScholesBI
Frequent Visitor
5 years ago
Solved

Next N Months date table

Hi,

 

I want to add a classification to my date table

I have already added:

 

 

IsCurrentQuarter = 
var qtr = QUARTER('Calendar'[Date])
var curr_qtr =QUARTER(TODAY())
var yr = YEAR('Calendar'[Date])
var curr_yr = YEAR(TODAY())
return
IF(qtr = curr_qtr && yr = curr_yr,"Yes","No")

 

Now I want to add "IsupcomingNmonths"  

N is the number of upcoming months.

 

Thanks,

 

 

  • That would just be 

    IsupcomingNmonths = 
    VAR _Months = DATEDIFF ( TODAY(), 'Calendar'[Date], MONTH )
    RETURN 
    IF ( _Months >= 0 && _Months <= 2, "Yes", "No" )

3 Replies

  • That would just be 

    IsupcomingNmonths = 
    VAR _Months = DATEDIFF ( TODAY(), 'Calendar'[Date], MONTH )
    RETURN 
    IF ( _Months >= 0 && _Months <= 2, "Yes", "No" )
  • ScholesBI 

    Try this assuming I understood what you were looking for.

    IsupcomingNmonths = 
    VAR _Months = DATEDIFF ( TODAY(), 'Calendar'[Date], MONTH )
    RETURN 
    IF ( _Months <= 0, BLANK(), _Months )
    • ScholesBI's avatar
      ScholesBI
      Frequent Visitor

      jdbuchanan71  Thanks, the formula works. However I actually need Today minus one month. So in  TODAY() = March upcoming 3 month equals March April May. And it should be rolling forward 3 months, with a "yes" / "no"result