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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tamas_Praviczki
Frequent Visitor

Calculated column

Hi everybody! I imported data into Power BI as Folder. I have a column which contains text values and one of column contains decimal numbers. I would like to add a new calculated column in specific way: If the text column equals for example "XY", I want to make a calculation with the second column, and then everything else would be the same value from the second column (with decimal numbers) so I don't need to calculate where there isn't "XY" value in the first column. I don't know the syntax.

Thanks for every good idea. 

1 ACCEPTED SOLUTION
Mrxiang
Helper II
Helper II

It sounds like you want to use a calculated column in Power BI to first check if a specific text value exists in the first column, and if it does, use the second column to perform some calculation and return a new value.
To do this, you can use the "CASE" statement in DAX to check if the text value exists in the first column, and then use the "RETURN" statement to return a calculated value using the second column.
Here is an example of how you could set this up in your report:

1.Create a new calculated column in your report called "Special Value".
2.In the formula bar, enter the following expression:

CASE(Table1[Text Column], Table2[Column 2])

This will check if the text value exists in the first column, and if it does, will return the value from the second column, using the syntax of the "CASE" statement.
Note that this assumes that your "Table1" table contains the text values and your "Table2" table contains the values from the second column that you want to use for the calculation.
I hope this helps! Let me know if you have any questions or need further assistance.

View solution in original post

1 REPLY 1
Mrxiang
Helper II
Helper II

It sounds like you want to use a calculated column in Power BI to first check if a specific text value exists in the first column, and if it does, use the second column to perform some calculation and return a new value.
To do this, you can use the "CASE" statement in DAX to check if the text value exists in the first column, and then use the "RETURN" statement to return a calculated value using the second column.
Here is an example of how you could set this up in your report:

1.Create a new calculated column in your report called "Special Value".
2.In the formula bar, enter the following expression:

CASE(Table1[Text Column], Table2[Column 2])

This will check if the text value exists in the first column, and if it does, will return the value from the second column, using the syntax of the "CASE" statement.
Note that this assumes that your "Table1" table contains the text values and your "Table2" table contains the values from the second column that you want to use for the calculation.
I hope this helps! Let me know if you have any questions or need further assistance.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors