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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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