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

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

Reply
Anonymous
Not applicable

IF Function two return text and value

Hi all!

I have two percentage columns:

 

Return Rate 1

Return Rate 2

 

I need to create two Measures to calculate:

 

 

Measure 1=

IF RT1 = 0, Return Text "N/a"

IF RT1 > RT2, Return Text "Out P"

IF RT2 < RT2, Return Text "Under P"

 

Measure 2=

IF RT1 = 0, Return Text "N/a"

IF RT1 > RT2, Return calculated value

IF RT2 < RT2, Return calculated value

 

Thank You!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous   ,

Some data I created:

v-yangliu-msft_2-1620698734837.png

Here are the steps you can follow:

Create measure.

Measure1 =
IF(
    MAX('Table'[Rate1])=0,"N/a",
    IF(MAX('Table'[Rate1])>MAX('Table'[Rate2]),"Out P","Under P"))

Result:

v-yangliu-msft_0-1620698623252.png

Measure2 =
IF(
    MAX('Table'[Rate1])=0,"N/a",
    IF(MAX('Table'[Rate1])>MAX('Table'[Rate2]),MAX('Table'[Rate1])-MAX('Table'[Rate2]),MAX('Table'[Rate1])+MAX('Table'[Rate2]))
)

Result

When rate1=0, return "n/a", when rate1>rate2, return rate1 rate2, and rate1 + rate2 when rate1 > rate2

v-yangliu-msft_1-1620698623256.png

 

Best Regards,

Liu Yang

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
Anonymous
Not applicable

Hi  @Anonymous   ,

Some data I created:

v-yangliu-msft_2-1620698734837.png

Here are the steps you can follow:

Create measure.

Measure1 =
IF(
    MAX('Table'[Rate1])=0,"N/a",
    IF(MAX('Table'[Rate1])>MAX('Table'[Rate2]),"Out P","Under P"))

Result:

v-yangliu-msft_0-1620698623252.png

Measure2 =
IF(
    MAX('Table'[Rate1])=0,"N/a",
    IF(MAX('Table'[Rate1])>MAX('Table'[Rate2]),MAX('Table'[Rate1])-MAX('Table'[Rate2]),MAX('Table'[Rate1])+MAX('Table'[Rate2]))
)

Result

When rate1=0, return "n/a", when rate1>rate2, return rate1 rate2, and rate1 + rate2 when rate1 > rate2

v-yangliu-msft_1-1620698623256.png

 

Best Regards,

Liu Yang

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

Fowmy
Super User
Super User

@Anonymous 

I did not understand

Measure 1 = 
var rt1 = SELECTEDVALUE(Table12[RT1])
VAR rt2 = SELECTEDVALUE(Table12[RT2])
return
    SWITCH( TRUE(),
        rt1 = 0, "N/a",
        rt1 > rt2, "Out P",
        rt2 < rt1, "Under P"
    )

 

If you want to use it as a column:

Measure 1 = 
var rt1 = Table12[RT1]
VAR rt2 = Table12[RT2]
return
    SWITCH( TRUE(),
        rt1 = 0, "N/a",
        rt1 > rt2, "Out P",
        rt2 < rt1, "Under P"
    )

 

the 2nd Measure you wanted. For the 1st measure, please use the following:

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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