How to Append Number and string in Power BI

Hi guys
I have Two columns
Column1 : Names (String)
Column2 : Salary (Number)
Like Below

What i want a New Column
If Salary of a person is greater than Thousands or Equals to (>=1000) means it should like 1k,2k.2.5k etc
If Salary of a person is greater than or Equals to Ten Lakhs (>=1000000) means it should like 1M,2M.2.Mk etc
If Salary is Less than Thousand(<1000) means it should remain same

Like Below Image

So Lets See how to do
Method 1:
Create a New Coloumn with Name “New Salary” and write formula

New Salary = IF(‘data type'[Salary]>=1000 && ‘data type'[Salary]<1000000,CONCATENATE(CONVERT(‘data type'[Salary]/1000, STRING),”K”),IF(‘data type'[Salary]<1000 , CONVERT(‘data type'[Salary],STRING),IF(‘data type'[Salary]>=1000000,CONCATENATE(CONVERT(‘data type'[Salary]/1000000, STRING),”M”))))

Now Add the Column to the Table

This image has an empty alt attribute; its file name is image-28.png

Method 2:
Let see Other way to do

First Create a column and define values based on Salary Column
Column Name : Units

Units = IF(‘data type'[Salary]<1000,BLANK(),IF(‘data type'[Salary]>=1000 && ‘data type'[Salary]<1000000 ,”K”,”M”))
The above column will save text data type
Like Below Image

Add Units to the table

Now Create One More Column
Column Name : Conversion
Conversion = IF(‘data type'[Salary]>=1000 && ‘data type'[Salary]<1000000,(‘data type'[Salary]/1000),IF(‘data type'[Salary]>=1000000,’data type'[Salary]/1000000,’data type'[Salary]))

Convert data Type to text

as Shown in Below figure

Add Conversion Column to Table

Now Create new column to join units column and conversion column
New Salary2 = CONCATENATE(‘data type'[Conversion],’data type'[Units])

Now add New Salary2 Column to the table

Thank You guys

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s