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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

How to use if else function using power query?

Hi all,

 

I wanna get the output column, i cannot use unpivote function as the table already pivot for other column( the picture just sample of column). It can cause duplication if unpivote the table.

Adlina_0-1666177483414.png

 

Then i tried to use if else function in power query but still cannot manage to do it.

Thank you for your help.

 

P/S: i need to get the output column using power query before 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Power Query  --  Add Column -- Custom Column.

vyangliumsft_0-1667292299349.png

2. Enter the following code.

if [Category] = "AA" then [Limit AA] else if [Category] = "BB" then [Limit BB] else [Limit CC]

vyangliumsft_1-1667292299351.png

3. Result:

vyangliumsft_2-1667292299352.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 ,

 

Here are the steps you can follow:

1. Power Query  --  Add Column -- Custom Column.

vyangliumsft_0-1667292299349.png

2. Enter the following code.

if [Category] = "AA" then [Limit AA] else if [Category] = "BB" then [Limit BB] else [Limit CC]

vyangliumsft_1-1667292299351.png

3. Result:

vyangliumsft_2-1667292299352.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

amitchandak
Super User
Super User

@Anonymous , A new column

if [Category] =  "AA" then [Limit AA]

else if [Category] =  "BB" then [Limit BB]

else if [Category] =  "CC" then [Limit CC]

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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