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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Messy92
New Member

IF statement problem

Hello!

I wanted to ask you something 

if i have

a mobile phone column,

a home phone column

and a other phone column

How can i create a new column where  i say that if there is at least a number in any of these columns then write me 1 or if there is any numbers in these columns then write me 0.

Thank you so much, sorry for my english im italian and im starting now to discover power bi Smiley Happy

1 ACCEPTED SOLUTION
v-xjiin-msft
Solution Sage
Solution Sage

Hi @Messy92,

 

Please refer to following sample, see if it works for you:

 

Flag =
IF (
    (
        IF ( ISBLANK ( Phones[mobile phone] ), 0, 1 )
            + IF ( ISBLANK ( Phones[Home phone] ), 0, 1 )
            + IF ( ISBLANK ( Phones[other phone] ), 0, 1 )
    )
        >= 1,
    1,
    0
)

4.PNG

 

Thanks,
Xi Jin.

View solution in original post

3 REPLIES 3
v-xjiin-msft
Solution Sage
Solution Sage

Hi @Messy92,

 

Please refer to following sample, see if it works for you:

 

Flag =
IF (
    (
        IF ( ISBLANK ( Phones[mobile phone] ), 0, 1 )
            + IF ( ISBLANK ( Phones[Home phone] ), 0, 1 )
            + IF ( ISBLANK ( Phones[other phone] ), 0, 1 )
    )
        >= 1,
    1,
    0
)

4.PNG

 

Thanks,
Xi Jin.

leslieangelia
Frequent Visitor

If you are doing this in the query editor rather (create a column) rather than in dax (create a measure) there is a built in feature that does not require you to know M.

 

You go to Add Column --> Conditional Column and then set your rules. 

if mobile phone column does not equal null, then 1

else if home phone does not equal null, then 1

else if other phone does not equal null, then 1

else 0

2018-04-26_1231

 

 

 

 

KellyDittmar
Advocate IV
Advocate IV

See this page for help:

 

https://msdn.microsoft.com/en-us/query-bi/dax/if-function-dax

 

The syntax for one if statement is this: IF(logical_test>,<value_if_true>, value_if_false)

 

If you have more than one check - which you do - then you need something more like this example - which is also from the page above: 

 

=IF([Calls]<200,"low",IF([Calls]<300,"medium","high"))

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors