Forum Discussion
Anonymous
5 years agoNot applicable
New Calculated Column using IF statement or SWITCH
Hello everyone, I have a question as to how to create a new calculcated column, based on the values of 2 columns. I'm really new to PowerBI, and to posting on this forum, so I don't know how to ...
camargos88
5 years agoCommunity Champion
Anonymous ,
I didn't get the second block for the if, but with this code you can create another column if necessary:
Monthly Incident Type =
IF( 'Table (2)'[Incident Code] in {13, 130, 131, 132, 133,134,135,136,137,138}, "Vehicle Fire",
IF('Table (2)'[Incident Code] in {322, 323, 324,352}, "Vehicle Accident",
IF( MID('Table (2)'[Incident Code], 1, 1) = "1", "Fire",
IF(MID('Table (2)'[Incident Code], 1, 1) = "2", "OverPressure",
IF(MID('Table (2)'[Incident Code], 1, 1) = "3", "EMS",
IF(MID('Table (2)'[Incident Code], 1, 1)= "4", "Hazamt"))))))
This block gets the first number and can be used for the others values:
MID('Table (2)'[Incident Code], 1, 1