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
abukapsoun
Post Patron
Post Patron

Multiplying values

Hi,

Need your support please.

I have the following Table

 

ReferenceP01P02
X-1000500
Y800-600
   
   

 

 

How can i transform the sign of values based on the following condition:

If Reference is X, then - make it + and the + make -

If reference is Y, then keep it as is

 

Many thanks in advance,

 

Regards,

 

 

1 ACCEPTED SOLUTION

Hi @abukapsoun 

 

There are 2 ways to do this.

 

  1. You can unpivot the columns, then create the new column with the IF function in DAX
  2. Or, you can create the IF function in Power Query Editor before unpivoting: Power Query > Add Column > Custom Column > Formula: if [Reference] = "X" then [P01]*-1 else [P01]

 

 

**Update: formula amended as needed

View solution in original post

9 REPLIES 9
Seenu80
Regular Visitor

Hi Experts,

need your support on below i have absolute value in one column

Shkg  Value

H        100.00

S           50.00

 

if H, i need to do 100.00*-1 if S then 50.00. can you suggest how can i add new column based on above condition.

 

Regards

Srini

amitchandak
Super User
Super User

@abukapsoun , new columns

 

new P1 = if([Reference] ="X", -1*[P1],[P1])
new P2 = if([Reference] ="X", -1*[P2],[P2])

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
darentengmfs
Post Prodigy
Post Prodigy

Hi @abukapsoun 

 

You can create a new column with IF function.

 

P01-New = IF('Table'[Reference] = "X", 'Table'[P01]*-1,'Table'[P01])

P02-New = IF('Table'[Reference] = "X", 'Table'[P02]*-1,'Table'[P02])

Thank you very much, will give it a try.

Will I be able to unpivot the columns P01- New and P02 New ?

 

@abukapsoun 

 

If this is a query, you can always unpivot it in Power Query mode.

 

Power Query > Transform > Unpivot Columns

Hi

 

I have created the new columns and it is working like a charm. However when I go to query editor to unpivot the columns, the newly created column does not appear in the table. I assume because they were created from a formula ? But then how can I unpivot them ?

I want to have them in the form of:

 

Thanks,

 

Hi @abukapsoun 

 

There are 2 ways to do this.

 

  1. You can unpivot the columns, then create the new column with the IF function in DAX
  2. Or, you can create the IF function in Power Query Editor before unpivoting: Power Query > Add Column > Custom Column > Formula: if [Reference] = "X" then [P01]*-1 else [P01]

 

 

**Update: formula amended as needed

I guess we are almost there, 

I tried creating the formula:

IF [Reference] = "X" then [P01]*(-1) else [P01]

 

But I am getting the following error on P01: Token Eof expected. 

 

Any idea?

 

i changed IF to if and it worked 🙂 thanksss

 

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.