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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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