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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
cristianml
Post Prodigy
Post Prodigy

IF..... Max Value from another column

Hi,

Need help with the following formula that is not working.

 

Fiscal Year =
IF('Rev Seq Database'[Current or Prior]="Current",CALCULATE(MAX('Revenue - CCI'[Fiscal Year]),
IF('Rev Seq Database'[Current or Prior]="Prior",CALCULATE(MAX('Revenue - CCI'[Fiscal Year]-1)),
IF('Rev Seq Database'[Current or Prior]="Prior -1",CALCULATE(MAX('Revenue - CCI'[Fiscal Year]-2),"qtd"))))

 

cristianml_0-1644280897898.png

Thanks

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @cristianml 

Try this:

Fiscal Year =
IF(
    'Rev Seq Database'[Current or Prior] = "Current",
    CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) ),
    IF(
        'Rev Seq Database'[Current or Prior] = "Prior",
        CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 1 ),
        IF(
            'Rev Seq Database'[Current or Prior] = "Prior -1",
            CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 2 ),
            "qtd"
        )
    )
)

Or:

Fiscal Year =
SWITCH(
    TRUE(),
    'Rev Seq Database'[Current or Prior] = "Current", CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) ),
    'Rev Seq Database'[Current or Prior] = "Prior", CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 1 ),
    'Rev Seq Database'[Current or Prior] = "Prior -1", CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 2 ),
    "qtd"
)

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

View solution in original post

2 REPLIES 2
v-angzheng-msft
Community Support
Community Support

Hi, @cristianml 

Try this:

Fiscal Year =
IF(
    'Rev Seq Database'[Current or Prior] = "Current",
    CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) ),
    IF(
        'Rev Seq Database'[Current or Prior] = "Prior",
        CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 1 ),
        IF(
            'Rev Seq Database'[Current or Prior] = "Prior -1",
            CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 2 ),
            "qtd"
        )
    )
)

Or:

Fiscal Year =
SWITCH(
    TRUE(),
    'Rev Seq Database'[Current or Prior] = "Current", CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) ),
    'Rev Seq Database'[Current or Prior] = "Prior", CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 1 ),
    'Rev Seq Database'[Current or Prior] = "Prior -1", CALCULATE( MAX( 'Revenue - CCI'[Fiscal Year] ) - 2 ),
    "qtd"
)

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

TheoC
Super User
Super User

Hi @cristianml 

 

Although there are a few other ways to achieve what you're after, I think you should remove CALCULATE and re-test your output. Also, adjust your -1 and -2 to be outside of your MAX ( Table[Column] ) (i.e. MAX ( Table[Column] ) -1...)

 

If that doesn't work, I'll put you a quick calculated column together.


Theo 🙂

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors