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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
bikelley
Helper IV
Helper IV

How to add if statement column values and give column name in else?

Hello, 


I am trying to change some names in my column, but I am not sure how to give column names as default or on else. Can anybody please tell me.  Please see below image, 

 

The isseu is I am not sure how to reffer colunm name in If stament. 

Cap.png

 

Thank you so much

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@bikelley , Syntax is wrong , In dax it like

if([_rep>3] ,3,_rep) //if(<condition>, <then> ,<else>)

 

or is ||

and is &&

 

refer: https://docs.microsoft.com/en-us/dax/if-function-dax

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

v-luwang-msft
Community Support
Community Support

Hi @bikelley 

You cold try  the following measure:

new accountname =
IF (
    'Account Name'[Ac+A1:A19count Name-Hierarchy level 2] = "Ch"
        || 'Account Name'[Ac+A1:A19count Name-Hierarchy level 2] = "Chi"
        || 'Account Name'[Ac+A1:A19count Name-Hierarchy level 2] = "Chic",
    "Chico",
    'Account Name'[Ac+A1:A19count Name-Hierarchy level 2]
)

final you will get like below:

v-luwang-msft_0-1614061647585.png

 

DAX IF:https://docs.microsoft.com/en-us/dax/if-function-dax 

or in dax:||

and in dax:&&

 

 if i answer your question,pls  Mark my post as a solution,thanks!

 

Best Regard

Lucien Wang

View solution in original post

4 REPLIES 4
v-luwang-msft
Community Support
Community Support

Hi @bikelley 

You cold try  the following measure:

new accountname =
IF (
    'Account Name'[Ac+A1:A19count Name-Hierarchy level 2] = "Ch"
        || 'Account Name'[Ac+A1:A19count Name-Hierarchy level 2] = "Chi"
        || 'Account Name'[Ac+A1:A19count Name-Hierarchy level 2] = "Chic",
    "Chico",
    'Account Name'[Ac+A1:A19count Name-Hierarchy level 2]
)

final you will get like below:

v-luwang-msft_0-1614061647585.png

 

DAX IF:https://docs.microsoft.com/en-us/dax/if-function-dax 

or in dax:||

and in dax:&&

 

 if i answer your question,pls  Mark my post as a solution,thanks!

 

Best Regard

Lucien Wang

@v-luwang-msft  Thank you so much this works well for me too. Again, thanks for the help. 

amitchandak
Super User
Super User

@bikelley , Syntax is wrong , In dax it like

if([_rep>3] ,3,_rep) //if(<condition>, <then> ,<else>)

 

or is ||

and is &&

 

refer: https://docs.microsoft.com/en-us/dax/if-function-dax

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandakThank you so much this makes sense. I appreciate your time. 

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.

Top Solution Authors