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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
ballist1x
Helper III
Helper III

Simply multiple IF in DAX

Hi can someone help me to cretae a multiple if statement column calculation in Dax?

 

= IF('Start Date'[Length of Tenure Absolute]<13,12,0), IF(AND('Start Date'[Length of Tenure Absolute]<25, 'Start Date'[Length of Tenure Absolute]>12),24,0),

 

IF and so on until 60 months

 

thanks!

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @ballist1x

 

I have make a demo which you could have a try.

 

column =
IF (
    'Start Date'[Length of Tenure Absolute] < 13,
    12,
    IF (
        'Start Date'[Length of Tenure Absolute] > 12
            && 'Start Date'[Length of Tenure Absolute] < 25,
        24,
        IF (
            'Start Date'[Length of Tenure Absolute] > 24
                && 'Start Date'[Length of Tenure Absolute] < 49,
            48,
            IF (
                'Start Date'[Length of Tenure Absolute] > 48
                    && 'Start Date'[Length of Tenure Absolute] < 61,
                60,
                0
            )
        )
    )
)

You could change the data in the condition as yours in this format.

 

In addition, you could make a reference of this similar post

 

If you need additional help please share some data sample. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-piga-msft

 

Hi i went for this in the end:

 

Less than 12 months = IF('Start Date'[Length of Tenure Absolute]<13,1,0)

 

12 Month Margin = (calculate(SUM('H12015'[Margin (£)]), (FILTER(ALL('Start Date'),('Start Date'[Length of Tenure Absolute]>=1 && ('Start Date'[Length of Tenure Absolute]<=12))))))/Sum('Start Date'[Less than 12 months])

 

then

 

Less than 24 months = IF(AND('Start Date'[Length of Tenure Absolute]<25, 'Start Date'[Length of Tenure Absolute]>12),2,0)/2

 

24 Month Margin = (calculate(SUM('H12015'[Margin (£)]), (FILTER(ALL('Start Date'),('Start Date'[Length of Tenure Absolute]>=12 && ('Start Date'[Length of Tenure Absolute]<=24))))))/Sum('Start Date'[Less than 24 months])

 

and do on, is this correct?

TomMartens
Super User
Super User

Hey,

 

I assume you are looking for the DAX function SWITCH(...)

Here is a example how you can leverage SWITCH with the boolean expression TRUE

https://community.powerbi.com/t5/Desktop/SWITCH-statement-in-DAX-using-a-quot-between-this-value-and...

 

Read until you find the answers from @greggyb, for now the last post links to more articles advocating for SWITCH

 

Hope this is what you are looking for

Tom   



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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