Forum Discussion
add countblank to table.profile
- 5 years ago
Try this Anonymous
I don't think you can have blanks for numerical fields - they get converted to nulls, and you cannot replace values with blanks, so I am assuming this is text.let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTIEYhOlWJ1opSQUXjKUB+akgBhQNoRpCGanQRUBebEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Data 1" = _t, #"Data 2" = _t, #"Data 3" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Data 2", type number}, {"Data 3", type number}}), Custom1 = Table.Profile( #"Changed Type", { { "Blanks", each Type.Is(_, type nullable any), each List.Count(List.Select(_, each _ = "")) } } ) in Custom1This is my dummy data:
And this is the result. Note: I removed a bunch of columns Table.Profile generates to get this screenshot:
Try this Anonymous
I don't think you can have blanks for numerical fields - they get converted to nulls, and you cannot replace values with blanks, so I am assuming this is text.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTIEYhOlWJ1opSQUXjKUB+akgBhQNoRpCGanQRUBebEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Data 1" = _t, #"Data 2" = _t, #"Data 3" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Data 2", type number}, {"Data 3", type number}}),
Custom1 =
Table.Profile(
#"Changed Type",
{
{
"Blanks", each Type.Is(_, type nullable any), each List.Count(List.Select(_, each _ = ""))
}
}
)
in
Custom1
This is my dummy data:
And this is the result. Note: I removed a bunch of columns Table.Profile generates to get this screenshot:
- edhans5 years agoCommunity Champion
Anonymous - did you try this solution?
- Anonymous4 years agoNot applicable
and also if i ignore the changed type rows (both) i get an error message
Expression.Error: We cannot convert a value of type List to type Table.
Details:
Value=[List]
Type=[Type]
- Anonymous4 years agoNot applicable
Hi Edhans
thanks for the solution but I don't understand the part :
Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTIEYhOlWJ1opSQUXjKUB+akgBhQNoRpCGanQRUBebEA", BinaryEncoding.Base64), Compression.Deflate)),my table comes is imported from a data base, not a json file, so how can I adapt this please,
cordially
walid
- edhans4 years agoCommunity Champion
See specifically step 5 below:
How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.- Anonymous4 years agoNot applicable
thank you very much for your answer, i think i am not far, because syntaxe is good but why should i transform the datatype of the columns, I want to keep them as it? and also should I replace the data 2 and 3 with real names of the columns because there are plenty and I will do it on many tables, so it may be very long?
let
Source = Sql.Database("SESKRUTDEVDB05", "REF_PDT"),
dbo_ODS_PDT_MARQUE = Source{[Schema="dbo",Item="ODS_PDT_MARQUE"]}[Data],#"Changed Type" = Table.TransformColumnTypes(Source,{{"Data 2", type number}, {"Data 3", type number}}),
Custom1 =Table.Profile(
#"Changed Type",
{
{
"Blanks", each Type.Is(_, type nullable any), each List.Count(List.Select(_, each _ = ""))
}
}
)
in
Custom1