Forum Discussion

UnknownUser1702's avatar
UnknownUser1702
New Member
2 years ago
Solved

Issues Calculating Offset Calendar

I have an intersting dilemma. There is an Account table that has a custom_start_month and custom_fiscal_year values.  custom_fiscal year can be current year or next year (next year moves the year fo...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, UnknownUser1702 

    Based on your information, I create a sample table:


    Then create calculated columns, here is the following DAX:

     

    AdjustedYear current = 
    VAR CurrentYear = YEAR('Date'[Date])
    VAR CurrentMonth = MONTH('Date'[Date])
    VAR AdjustedYear = 
        IF(
            MAX('Account'[Custom_Fiscal_Year]) = "Current Year",
            IF(CurrentMonth >= MAX('Account'[Custom_Start_Month]), CurrentYear + 1, CurrentYear),
            IF(CurrentMonth >= MAX('Account'[Custom_Start_Month]), CurrentYear, CurrentYear - 1)
            
        )
    RETURN AdjustedYear
    
    AdjustedYear next = 
    VAR CurrentYear = YEAR('Date'[Date])
    VAR CurrentMonth = MONTH('Date'[Date])
    VAR AdjustedYear = 
        IF(
            MAX('Account'[Custom_Fiscal_Year]) = "Next Year",
            IF(CurrentMonth >= MIN('Account'[Custom_Start_Month]), CurrentYear + 1, CurrentYear),
            IF(CurrentMonth >= MIN('Account'[Custom_Start_Month]), CurrentYear, CurrentYear - 1)
            
        )
    RETURN AdjustedYear
    

     

     

    I've created a few other calculated columns to compare, such as the largest start month, and so on. Here is my preview:

     

    How to Get Your Question Answered Quickly

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.