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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PBI_newuser
Post Prodigy
Post Prodigy

How to extract the correct code

Hi,

 

I have a list of problem code and I wish to extract the information C162, C200 and C198 from the list.

How can I do that?

Example:

  1. DS (Dispenser) (C162) --ComA
  2. C200 Mechanical
  3. Hardware (C198) --Default
8 REPLIES 8
PhilipTreacy
Super User
Super User

Hi @PBI_newuser 

Then there is no way to do what you want.  If you can't create a table to tell PBI/PQ what the expected output should be, it won't know what to do.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
Super User

Hi @PBI_newuser 

You'll have to create the table, that's how PBI/PQ will know what the output will look like.

See this Excel workbook to illustrate what I mean.  I've created a tale with the Problem codes and another table with the Standardized Problem and expected Output.

I don't know what your data source is but thisshows how to do it in Excel.

You can also load or create a table in Power BI to do the same.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy, I can't create the lookup table as I have more than 1000 cause code and problem code with different format in the table.

PhilipTreacy
Super User
Super User

Hi @PBI_newuser 

Yes. If you have a 2nd table with the Standardized Code and the Expected Output, you can join the 2 tables to get the result you want.

Here's a sample PBIX showing this working

code-table.png

 

std-problems.png

If you don't want the middle column in the final table, just delete it.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy , I don't have 2nd table with the Standardized Code and the Expected Output, but I wish to transform the "Problem Code" to "Expected Output". Is it possible?

 

For example:

Problem Code

C110 CV's

CV's (C110) --Default

Ouput

C110 - CV's

 

Thanks.

PBI_newuser
Post Prodigy
Post Prodigy

Hi @PhilipTreacy , it works!!
Is it possible to standardized the problem code with description (Expected Output) as shown below?

Problem CodeStandardized Problem CodeExpected Output
Drawer won't open (C747) --BBBC747C747 - Drawer won't open
Incorrect / Unexpected Results (C169) --DefaultC169C169 - Incorrect Unexpected esults
Mixtures (e.g. Rack, Tray, Holders) (C163) --ComC163C163 - Mixtures (e.g. Rack, Tray, Holders)
Cable / Wiring / Connector (C104) --DefaultC104C104 - Cable Wiring Connector onnector
C110 CV'sC110C110 - CV's
CV's (C110) --DefaultC110C110 - CV's
Analysis Software (e.g. DiVA) (C150) --DefaultC150C150 - Analysis Software (e.g. DiVA)
Sample (aspiration, dispense) (C186) --AC186C186 - Sample (aspiration, dispense)
A&T / Setup (C816) --DefaultC816C816 - A&T / Setup
Others (C200); describe specifics in CAUSE --DefaultC200C200 - Others
C113 Electrical PowerC113C113 - Electrical Power
Electrical Power (C113) --BBBC113C113 - Electrical Power
Electrical Power (C113) --DefaultC113C113 - Electrical Power
amitchandak
Super User
Super User

@PBI_newuser , What output you need is not very clear. Try new column like

if( search("C162",[column],,0) >0 || search("C200",[column],,0) >0 || search("C198",[column],,0) >0,1, 0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
PhilipTreacy
Super User
Super User

Hi @PBI_newuser 

This works with the examples you've supplied.  The query expects all error codes to start with C. 

Copy andpaste the code below into a new blank query or use this  sample PBIX file showing it working

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcglW0HDJLC5IzStOLdJU0HA2NDPSVNDVdc7PdVSK1YlWcjYyMFDwTU3OSMzLTE7MAYt5JBallCcWpYKUW1qAlLukpiWW5pQoxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Problem Code" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Problem Code", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each "C"&Text.Combine(List.RemoveItems(Text.ToList(Text.Lower([Problem Code])),{"a" .. "z", "(",")"," ","-"})))
in
    #"Added Custom"

 

 

error-code.png

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors