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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
NHW
New Member

Unable to figure out the difference in the code.

Hi, I am unable to figure out why I cannot replicate the result in the above table. The difference lies in the results under the verdict legend. 

NHW_0-1690880630009.png

 

 

This is the related power query m code for the above table:

#"Added Conditional Column" = Table.AddColumn(#"Renamed Columns2", "Verdict Score", each if [#"Overall Verdict "] = "IN" then 0 else if [#"Overall Verdict "] = "JI" then 0.5 else if [#"Overall Verdict "] = "OUT" then 3 else null, type number),
#"Replaced Value1" = Table.ReplaceValue(#"Added Conditional Column","Out","OUT",Replacer.ReplaceText,{"Overall Verdict "}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","In","IN",Replacer.ReplaceText,{"Overall Verdict "}),
#"Replaced Value3" = Table.ReplaceValue(#"Replaced Value2","Just In","JI",Replacer.ReplaceText,{"Overall Verdict "}),
#"Replaced Value4" = Table.ReplaceValue(#"Replaced Value3","Just IN","JI",Replacer.ReplaceText,{"Overall Verdict "}),
#"Removed Columns3" = Table.RemoveColumns(#"Replaced Value4",{"Verdict Score"}),
#"Added Conditional Column1" = Table.AddColumn(#"Removed Columns3", "Custom", each if [#"Overall Verdict "] = "IN" then 0 else if [#"Overall Verdict "] = "OUT" then 3 else if [#"Overall Verdict "] = "JI" then 0.5 else null, type number),
#"Renamed Columns3" = Table.RenameColumns(#"Added Conditional Column1",{{"Custom", "Verdict Score"}}),

 

This is the related power query M code for the bottom table: 

#"Added Conditional Column" = Table.AddColumn(#"Renamed Columns", "Verdict Score", each if [#"Overall Verdict "] = "IN" then 0 else if [#"Overall Verdict "] = "Just IN" then 0.5 else if [#"Overall Verdict "] = "OUT" then 3 else null),

#"Replaced Value" = Table.ReplaceValue(#"Removed Columns","JI","Just In",Replacer.ReplaceText,{"Overall Verdict "}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","Out","OUT",Replacer.ReplaceText,{"Overall Verdict "}),
#"Replaced Value3" = Table.ReplaceValue(#"Replaced Value2","In","IN",Replacer.ReplaceText,{"Overall Verdict "}),

2 REPLIES 2
Mahesh0016
Super User
Super User

@NHW Please try below code, i hope this hepls you!

#"Replaced Value" = Table.ReplaceValue(#"Removed Columns","JI","Just In",Replacer.ReplaceText,{"Overall Verdict "}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","Out","OUT",Replacer.ReplaceText,{"Overall Verdict "}),
#"Replaced Value3" = Table.ReplaceValue(#"Replaced Value2","In","IN",Replacer.ReplaceText,{"Overall Verdict "}),
#"Added Conditional Column" = Table.AddColumn(#"Replaced Value3", "Verdict Score", each if [#"Overall Verdict "] = "IN" then 0 else if [#"Overall Verdict "] = "Just IN" then 0.5 else if [#"Overall Verdict "] = "OUT" then 3 else null)

Hi, isn't the below code that you have provided to help the same as the code I am using currently?

Here is a better example of the issue:

NHW_0-1691026494579.png

 



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.