Suneth
Suneth

Reputation: 209

How to show blank with a text in Power BI with creating measure?

Can anybody please tell me to create a measure that replaces the blank value with text?

Here is my situation. I have the Vendor field from the Vendor table and CSM_Item_No from the Item table. Most of the CSM_Item_No does not have a Vendor Name. I want to replace them with "No Vendor". I know there are so many ways you can do it, by using IF, ISBlank, etc., but when I create a measure I can't give Vendor Feild from the vendor table. This where I got stuck. Any help will be really appreciated.

enter image description here

See below it will not recognize my feilds. Is there any way I can get this done? enter image description here Thank you so much

Upvotes: 0

Views: 4847

Answers (2)

mkRabbani
mkRabbani

Reputation: 16908

Try this below measure. Remember, this is not a replacement to the original column or value. But you can use this measure in table or other visual to show "No Vendor" where there is no data in the original column. This way you can keep original and customize both data.

vendor_name = 

var current_row_name = MIN(table_name[Name])

RETURN 
IF(
    current_row_name = BLANK(), 
    "No Vendor", 
    current_row_name
)

If you need a calculated column, you can try this below code-

vendor_name_column = 

var current_row_name = table_name[Name]

RETURN 
IF(
    current_row_name = BLANK(), 
    "No Vendor", 
    current_row_name
)

Upvotes: 1

Naro
Naro

Reputation: 810

You can not resolve your probleme with a measure, its not what measures do. to resolve your probleme consider two approches :

1- the best solution is to replace blank values in power query editor.

2- the second solution is using a calculated column with an if condition.

Upvotes: 1

Related Questions