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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
LFM
Helper III
Helper III

Minus sign in front of value where there is a certain text

Hello. I want to make a minus sign in front of a value in a column that corresponds to a text value in another column. Shown under I want make a "-" sign in front of all the numbers in lots when buy or sell is sell?

LFM_0-1721400637958.png

Like this:

Buy2
Sell-1
Sell-3
Buy2
Sell-1
1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @LFM ,

 

There are multiple ways to achieve your required output, and one of them is to write a calculate column like below:

 

Sign = if('Table'[Text]="Sell",'Table'[Lots]*-1,'Table'[Lots])

 

 

DataNinja777_0-1721402256669.png

I attach an example pbix file.  

Best regards,

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

Minus sign in front of a value that corresponds to... - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Kaviraj11
Super User
Super User

Hi,

 

You can create a calculated column as below:

 

ColumnName=

SWITCH(TRUE(),TableName[Buy or Sell]="Sell",-ABS(TableName[Lots]),ABS(TableName[Lots]))
 
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
 
 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





DataNinja777
Super User
Super User

Hi @LFM ,

 

There are multiple ways to achieve your required output, and one of them is to write a calculate column like below:

 

Sign = if('Table'[Text]="Sell",'Table'[Lots]*-1,'Table'[Lots])

 

 

DataNinja777_0-1721402256669.png

I attach an example pbix file.  

Best regards,

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.