We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I'm loading 20 tables directly into the powerbi. This upload will be monthly, but a table or another table may be empty.
So when I change the field type, the script stops because Power BI did not find any value when it promoted the headers.
What can I do to make the upload continue smoothly when a table is empty?
I would like, by identifying the table to be empty, Power BI or ignore this table, or write only the headers that I need to continue the script.
Something like:
if (Table.IsEmpty = true) then Table.FromRows ({ {null, null}}, {field1, field2}) else each ([field1] <> "xxxxx"))
I'm using a translator, sorry.
Thank you so much!
-----------------------------------------
Estou carregando 20 tabelas diretamente para o powerbi. Esse carregamento será mensal, porém pode acontecer de uma tabela ou outra estar vazia.
Por isso, quando faço a alteração do tipo do campo, o script é interrompido, porque o Power BI não encontrou nenhum valor quando promoveu os cabeçalhos.
O que posso fazer para que o carregamento continue sem problemas quando uma tabela estiver vazia?
Gostaria de, ao identificar que a tabela é vazia, o Power BI ou ignorasse esta tabela, ou escrevesse apenas os cabeçalhos que preciso para dar continuidade no script.
Algo como:
if (Table.IsEmpty = true) then Table.FromRows({{null, null}},{campo1, campo2}) else each ([campo1] <> "xxxxx"))Muito Obrigado!
Are these 20 tables being loaded in 20 different queries?
Yes
The code below creates a table, at random either empty or with 2 columns and 2 rows (1 header and 1 data).
Next, if the table is empty, it creates a table with 2 columns and 1 row (for the headers).
Then the headers are promoted.
let
Source = if Number.Random() < 0.5 then #table(0,{}) else #table(2,{{"field1","field2"},{"value1","value2"}}),
Custom1 = if Table.IsEmpty(Source) then #table(2,{{"field1","field2"}}) else Source,
#"Promoted Headers" = Table.PromoteHeaders(Custom1, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"field1", type text}, {"field2", type text}})
in
#"Changed Type"
I will try it, thank you so much!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 56 | |
| 40 | |
| 36 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 38 | |
| 34 | |
| 23 |