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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
spandy34
Responsive Resident
Responsive Resident

IF Statement

Hi

 

I am trying to create a column in my table called "Value"that looks at the number in the Actual Duration column and inputs a value based on the table below.  Please can someone help me with the the DAX coding to get his result.

 

Many thanks

 

 

Actual Duration Value
0-1515
16-2020
21-3030
1 ACCEPTED SOLUTION

Hi, @spandy34 

Please try following steps:

1.add calculated columns "Start",'End' as below:

Start = LEFT('Table'[Actual Duration], search("-",'Table'[Actual Duration])-1)
End = RIGHT('Table'[Actual Duration],len('Table'[Actual Duration])-search("-",'Table'[Actual Duration]))

veasonfmsft_0-1656987413121.png

2.Add a measure like:

Result =
CALCULATE (
    MAX ( 'Table'[Value] ),
    FILTER (
        'Table',
        'Table'[Start] <= MAX ( 'Fact Table'[Actual Duration] )
            && 'Table'[End] >= MAX ( 'Fact Table'[Actual Duration] )
    )
)

veasonfmsft_1-1656991344052.png

 

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
spandy34
Responsive Resident
Responsive Resident

Hi

 

I am trying to create a column in my table called "Value"that looks at the number in the Actual Duration column and inputs a value based on the table below.  Please can someone help me with the the DAX coding to get his result.

 

Many thanks

 

 

Actual Duration Value
0-1515
16-2020
21-3030

@amitchandak 

 

 

Hi, @spandy34 

Please try following steps:

1.add calculated columns "Start",'End' as below:

Start = LEFT('Table'[Actual Duration], search("-",'Table'[Actual Duration])-1)
End = RIGHT('Table'[Actual Duration],len('Table'[Actual Duration])-search("-",'Table'[Actual Duration]))

veasonfmsft_0-1656987413121.png

2.Add a measure like:

Result =
CALCULATE (
    MAX ( 'Table'[Value] ),
    FILTER (
        'Table',
        'Table'[Start] <= MAX ( 'Fact Table'[Actual Duration] )
            && 'Table'[End] >= MAX ( 'Fact Table'[Actual Duration] )
    )
)

veasonfmsft_1-1656991344052.png

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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