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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.