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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
glatzmarcus
New Member

Preciso transforma uma lista no Power Query em uma nova coluna de uma tabela específica

Prezada comunidade, eu importei meus dados a partir de uma tabela .xlsx e preciso criar uma nova tabela a partir do somatório de valores conteúdos em outros colunas da minha tabela importada. Na tabela importada, essas almofadas são inspiradas com o 'header' em dados, por exemplo, "01/01/2022" "01/02/2022", assim sucessivamente. Na minha nova tabela preciso criar 3 novas sonoras, uma para dados, como tudo é relacionado a "2022" pode ser apenas os meses apresentados "janeiro", "fevereiro"..... No PowerQuery adicionoui uma nova tabela e a primeira coluna implementei manualmente os meses, e fui em "adicionar nova coluna", e a seguinte fórmula foi executada:

= Table.AddColumn(#"Tipo Alterado1", "Orçado", each {List.Sum(Table.Column(#"Dados (2)", "1/1/2022")), List.Sum(Table.Column (#"Dados (2)", "2/1/2022")), List.Sum(Table.Column(#"Dados (2)", "3/1/2022")), List.Sum(Table .Column(#"Dados (2)", "4/1/2022")), List.Sum(Table.Column(#"Dados (2)", "5/1/2022")), List.Sum (Table.Column(#"Dados (2)", "6/1/2022")), List.Sum(Table.Column(#"Dados (2)", "7/1/2022")), List .Sum(Table.Column(#"Dados (2)", "8/1/2022")), List.Sum(Table.Column(#"Dados (2)", "9/1/2022")) , List.Sum(Table.Column(#"Dados (2)", "10/1/2022")), List.Sum(Table.Column(#"Dados (2)", "11/1/2022" )), Lista.Soma(Tabela.Column(#"Dados (2)", "12/1/2022"))})

 Nenhuma coluna sendo "Orçada" a partir de uma lista, criada de acordo com a somatória de valores de cada coluna dos meus dados importados. A questão é que, de fato consegui com a lista o que eu queria, porém minha coluna não foi desejada, pois cada célula está a lista completa de valores, ao invés de distribuir cada item da lista para cada célula. Como podemos ver abaixo: erro_powerbi.png

Então decida criar uma lista através de uma consulta, dessa forma: 

= {List.Sum(Table.Column(#"Dados (2)", "1/1/2022")), List.Sum(Table.Column(#"Dados (2)", "2/1/2022 ")), List.Sum(Table.Column(#"Dados (2)", "3/1/2022")), List.Sum(Table.Column(#"Dados (2)", "4/1 /2022")), List.Sum(Table.Column(#"Dados (2)", "5/1/2022")), List.Sum(Table.Column(#"Dados (2)", "6 /1/2022")), List.Sum(Table.Column(#"Dados (2)", "7/1/2022")), List.Sum(Table.Column(#"Dados (2)", "01/08/2022")), List.Sum(Table.Column(#"Dados (2)", "01/09/2022")), List.Sum(Table.Column(#"Dados (2) ", "10/1/2022")), List.Sum(Table.Column(#"Dados (2)", "11/1/2022")), List.Sum(Table.Column(#"Dados ( 2)", "01/12/2022"))}

deu certo, conforme figura: erro_powerbi2.png

Porém não consigo da mesma forma importar valores para minha tabela, pois diz que são valores em formato 'text'. Alguém pode me ajudar?

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @glatzmarcus 

Hi , @glatzmarcus 

According to your description, you have calculated the value by date as a value list in Power Query. And you want to add the list to each date as a column . Right?

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1670808831020.png

vyueyunzhmsft_3-1670808923780.png

 

(2)Then we can create a blank quert and enter:

vyueyunzhmsft_2-1670808857187.png

= Table.FromColumns({Table.ToColumns(Date){0},Table})

Then we can get your need:

vyueyunzhmsft_4-1670808993585.png

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @glatzmarcus 

Hi , @glatzmarcus 

According to your description, you have calculated the value by date as a value list in Power Query. And you want to add the list to each date as a column . Right?

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1670808831020.png

vyueyunzhmsft_3-1670808923780.png

 

(2)Then we can create a blank quert and enter:

vyueyunzhmsft_2-1670808857187.png

= Table.FromColumns({Table.ToColumns(Date){0},Table})

Then we can get your need:

vyueyunzhmsft_4-1670808993585.png

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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