This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi All,
I have this code below. I am not sure how to get rid of the Errors.
I want all (Blank) to just say Blank and null to say N/A
let
Source = #"FACT TABLE",
#"Detected Type Mismatches" = let
tableWithOnlyPrimitiveTypes = Table.SelectColumns(Source, Table.ColumnsOfType(Source, {type nullable number, type nullable text, type nullable logical, type nullable date, type nullable datetime, type nullable datetimezone, type nullable time, type nullable duration})),
recordTypeFields = Type.RecordFields(Type.TableRow(Value.Type(tableWithOnlyPrimitiveTypes))),
fieldNames = Record.FieldNames(recordTypeFields),
fieldTypes = List.Transform(Record.ToList(recordTypeFields), each [Type]),
pairs = List.Transform(List.Positions(fieldNames), (i) => {fieldNames{i}, (v) => if v = null or Value.Is(v, fieldTypes{i}) then v else error [Message = "The type of the value does not match the type of the column.", Detail = v], fieldTypes{i}})
in
Table.TransformColumns(Source, pairs),
#"Added Index" = Table.AddIndexColumn(#"Detected Type Mismatches", "Row Number" ,1),
#"Kept Errors" = Table.SelectRowsWithErrors(#"Added Index", {"Source.Name", "SDR ID", "Site", "Card number", "CP ID", "Connector", "Charger Type", "Amount", "Consum(kWh)", "Duration", "Start Date", "Start Time", "End Date", "End Time", "Payment Status", "Start Hour", "Payment Method"}),
#"Reordered Columns" = Table.ReorderColumns(#"Kept Errors", {"Row Number", "Source.Name", "SDR ID", "Site", "Card number", "CP ID", "Connector", "Charger Type", "Amount", "Consum(kWh)", "Duration", "Start Date", "Start Time", "End Date", "End Time", "Payment Status", "Start Hour", "Payment Method"})
I highly appreciate any help with this.
Thank you,
jiCAT
in
#"Reordered Columns"
Solved! Go to Solution.
Hello - it looks like the script you are showing here is for the errors table that Power Query creates instead of the actual data table with th errors. Below is how you can replace blanks with Blank and nulls with N/A. You will need to do this on the actual data table.
Replace Blanks:
Replace Nulls:
Hello - it looks like the script you are showing here is for the errors table that Power Query creates instead of the actual data table with th errors. Below is how you can replace blanks with Blank and nulls with N/A. You will need to do this on the actual data table.
Replace Blanks:
Replace Nulls:
Thank you @jennratten,
It worked magic. I must remember to use the simplest solution first.
Much appreciate your help.
Best,
jiCAT
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.