KReEd
KReEd

Reputation: 378

Replace values in cell with DAX coding in Power bi

I have my data(file name - Data) which I have imported in power bi with a column named values

values
ext
int
safety_int
outside_training
gap_fill_int

so it is a large data, and it contains more than 2k categories , what I want is, to create a new column in power bi where blanks should be replaced with target_emp, and all other values(ext,int,gap_filling_int etc.) should be replaced with non_target_emp. Please help me to do that in power bi.

Upvotes: 1

Views: 2100

Answers (3)

smpa01
smpa01

Reputation: 4346

#1 DAX

calculatedColumn= SWITCH(TRUE(), Data[Column1]=BLANK(),"target_emp", "non_target_emp")

Solution

#2 using PBI's binning

go to report view->click on the table->column name-> New Group Solution2

Solution3

Upvotes: 0

VBA Pete
VBA Pete

Reputation: 2666

You could add a conditional column in the data model (sorry that I dont have an English screenshot for this):

  1. Add column
  2. Select conditional column
  3. Add criteria to selection

enter image description here

Upvotes: 0

msta42a
msta42a

Reputation: 3741

In powerbi transform ->

Add Column:

if Text.Trim([category]) = "" then "target_emp" else "non_target_emp"

enter image description here

Upvotes: 2

Related Questions