Ошибка power query expression error

 

RLL

Пользователь

Сообщений: 19
Регистрация: 08.05.2018

Всем привет.

Возникает ошибка в запросе. Файл по ссылке:

пример

Софт Excel 2013 Power Query.

В чем причина?

 

PooHkrd

Пользователь

Сообщений: 6602
Регистрация: 22.02.2017

Excel x64 О365 / 2016 / Online / Power BI

#2

25.10.2018 12:53:46

Не только лишь все могут выгрузить ваш файл в рабочее время, мало кто может это сделать.
Если файл такой тяжелый, то покажите хотя бы код запроса, скриншот ошибки и шаг на котором возникает эта ошибка.
Также рекомендую предложить новое название темы с текстом ошибки, данное название слишком обобщенное и не очень удовлетворяет правилам форума.
Если под ошибкой подразумевается текст из предыдущей закрытой темы  Power Query.Expression.Error: Не удается преобразовать значение 8121530545 в тип Text То у вас проблема в том, что вы в какой-то формуле пытаетесь объединить числовые значения с текстовыми. Скорее всего вы это делаете при помощи знака «&». PQ не умеет на лету преобразовывать типы данных, поэтому он вам ругается. Перед шагом, на котором вы производите объединение нужно изменить тип данных на текстовый, либо в формуле с объединением вместо числового значения, например [СтолбецСЧислами], нужно писать

Код
Text.From( [СтолбецСЧислами] )

Изменено: PooHkrd25.10.2018 13:13:40

Вот горшок пустой, он предмет простой…

 

Anton555

Пользователь

Сообщений: 746
Регистрация: 16.08.2018

#3

25.10.2018 14:33:42

вам выше все правильно сказали

Код
let
    Источник = Excel.CurrentWorkbook(){[Name="Таблица1"]}[Content],
    #"Измененный тип" = Table.TransformColumnTypes(Источник,{{"Периметр", type text}}),
    #"Разделить столбец по разделителю" = Table.ExpandListColumn(Table.TransformColumns(#"Измененный тип", {{"Периметр", Splitter.SplitTextByDelimiter(" / ", QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Периметр")
in
    #"Разделить столбец по разделителю"

Изменено: Anton55525.10.2018 14:33:50

 

Anton555

Пользователь

Сообщений: 746
Регистрация: 16.08.2018

#4

25.10.2018 14:49:31

чтобы подсократить кол-во строк

Код
let
    Источник = Excel.CurrentWorkbook(){[Name="Таблица1"]}[Content],
    #"Строки с примененным фильтром" = Table.SelectRows(Источник, each ([Периметр] <> null)),
    #"Разделить столбец по разделителю" = Table.ExpandListColumn(Table.TransformColumns(Table.TransformColumnTypes(#"Строки с примененным фильтром",{{"Периметр", type text}}), {{"Периметр", Splitter.SplitTextByDelimiter(" / ", QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Периметр")
in
    #"Разделить столбец по разделителю"

и для чего вы такой большой диапазон для «таблицы1» выбрали? с А1 и до А1ххххххх ?

Изменено: Anton55525.10.2018 14:49:39

 

RLL

Пользователь

Сообщений: 19
Регистрация: 08.05.2018

Так как у меня нет опыта в программировании, вы не могли бы подробнее разъяснить свои действия?

 

PooHkrd

Пользователь

Сообщений: 6602
Регистрация: 22.02.2017

Excel x64 О365 / 2016 / Online / Power BI

Откройте ваш запрос, перейдите на второй по счету шаг с названием «Измененный тип» потом нажмите на кнопку в левом верхнем углу столбца как на скриншоте и выберите тип данных для столбца «Текст». Все должно наладиться.

Изменено: PooHkrd25.10.2018 16:15:41

Вот горшок пустой, он предмет простой…

 

Anton555

Пользователь

Сообщений: 746
Регистрация: 16.08.2018

#7

25.10.2018 17:00:18

без этой строки

Код
#"Строки с примененным фильтром" = Table.SelectRows(Источник, each ([Периметр] <> null)),

не наладится, т.к. таблица1 имеет диапазон до самого конца листа и будет выдавать ошибку  — что-то типа excel не может загрузить все строки, т.к. они не помещаются в диапазон листа

 

RLL

Пользователь

Сообщений: 19
Регистрация: 08.05.2018

Спасибо всем, я так и сделал.

Администратор, возможно ли удалить файл, так как в нем содержатся личные сведения?

 

vikttur

Пользователь

Сообщений: 47199
Регистрация: 15.09.2012

Удалил, но боты не дремлют, страница уже могла быть проиндексирована… И здесь-то удалено, а сами по ссылке файл оставили.
Сколько людям пишем — готовьте файлы-примеры. А лень,  рабочие файлы показывают…

 

RLL

Пользователь

Сообщений: 19
Регистрация: 08.05.2018

 

КБМ

Пользователь

Сообщений: 16
Регистрация: 17.02.2018

#11

07.05.2021 15:35:03

Цитата
RLL написал: Возникает ошибка в запросе.

У меня подобная ошибка вышла даже при типе данных всех столбцов текст. Причина оказалась в ошибке в некоторых ячейках (error). Пришлось заменять ошибки на null, но это делать тоже надо аккуратно, — понимать что явилось причиной, что бы не потерять данные.

Изменено: vikttur07.05.2021 15:46:11

  • Remove From My Forums
  • Question

  • Hi,

    I have a simple query that appends 2 queries and has a column that contains 10 digit numbers. A preview of the query loads in the editor with no issues. When I try to load the query to the data model I get the error «Expression.Error: We cannot convert
    the value 2468999999 to type text». I have tried changing the column to type text in the power query editor but still get the error.

    I was also getting the error in one of the queries that is appended when I tried to sort by another column, until I removed that step.

    I do not understand why a conversion to text is happening, can anyone help please?

    Edit to add: I appear to have found a solution. The source data is a folder of Excel files. In one of these files the problem column was formatted as Number, in the others it was formatted as text. I changed the format to text in that file and the error
    no longer appears. 

    However, I still do not understand why the error was appearing and why using the power query editor to explicitly change the data type to either integer or text did not work?

    Thanks

    Alex

    • Edited by

      Friday, August 30, 2019 9:51 AM

Answers

  • It’s difficult to say exactly what’s going on without seeing your file, but I would definitely recommend you convert the column in the Transform File query, rather than downstream.

    Ehren

    • Marked as answer by
      AJR1385
      Thursday, September 5, 2019 3:32 PM

SOLVED USING A DIFFERENT APPROACH (see at the end)

I am trying to combine some queries into one by using the Table.Combine() function.

If I explicitly write the name of each query (e. g., Table.Combine({#»Name of query 1″, #»Name of query 2″})) and then apply the changes, everything works fine.

However, since I want to make it dynamic, instead of writing a list of names, I pass the function a list of tables generated in a previous step:

[ALT TEXT: screenshot of a table of two columns ("Name" and "Value"), with four records. "Name": COMPRAS Y GASTOS 2019... until COMPRAS Y GASTOS 2022. "Value": an object of type Table in each of the four cells].

So after I get this table, the next step is: = Table.Combine(PreviousStep[Value]). Note that Value is the name of the column that contains the tables. Apparently, by doing so this column of a table containing tables is converted to a list containing tables. This works fine (I can preview the resultset) until I hit that Apply changes button. When I do it, this message pops up:

[ALT TEXT & translation: Error pop-up message: "Load. Anexar1 (which is the name of the query): OLE DB or ODBC error: [Expression.Error] Cannot convert the value null to type Table"].

I had a look at these threads: https://community.powerbi.com/t5/Desktop/We-cannot-convert-the-value-null-to-type-Table/td-p/391064, https://community.powerbi.com/t5/Desktop/We-cannot-convert-the-value-null-to-type-table/m-p/346056, but it didn’t work. I’ve tried other approaches as well.

Further information:

  • Power BI Desktop version: 2.106.582.0 64-bit (June 2022)
  • Data source: combining existing queries that come from a single Excel file.
  • Steps followed to get that list of tables that I pass the Table.Combine() function:
    let
    Origen = #sections[Section1],
    #"Convertido en tabla" = Record.ToTable(Origen),
    #"Errores quitados" = Table.RemoveRowsWithErrors(#"Convertido en tabla", {"Value"}),
    Personalizado1 = Table.SelectRows(#"Errores quitados", each Text.StartsWith([Name], "COMPRAS Y GASTOS")),
    Personalizado2 = Table.Combine(Personalizado1[Value])
    in
    Personalizado2

I access all the queries I have (with the #sections keyword), convert it to a table, remove possible errors, filter to get the queries I want (the ones starting by «COMPRAS Y GASTOS») and then try to combine the queries).

A DIFFERENT APPROACH
What I wanted to do was merge tables that came from an Excel file, each of them referring to a year (2019, 2020, 2021, 2022). But I also wanted the combined table to update when new sheets were added on Excel (2023, 2024…).

I’ve tried many different approaches, like generating a dynamic list (from 2019 until the current year)… but for some reason none of them worked, even though the code apparently is correct.

So my new approach has been to create a sufficient amount of Excel sheets for the coming years (that are now empty, but when the new year comes the information will be filled in there), to create the queries referring to those sheets (they return empty tables) and merging those existing (but empty) tables with the ones from 2019-2022. This way, when data from 2023 is filled in in the sheet, the query is updated and it works.

It’s a shame I couldn’t actually solve the original problem I had, but this approach works.

  • Remove From My Forums

 locked

Power Query Error Expression.Error: We cannot convert the value .. to type Text

  • Question

  • Hi All, 
    I’ve imported a number of excel sheets into a Power Query Table. All seems to appear ok until I load the data. Of the 15k rows around 2k have a similar error where it cannot convert an integer to type string as below example

    Expression.Error: We cannot convert the value 40 to type Text.
    Details:
        Value=40
        Type=Type

    The columns in question are all of integer type, I’ve looked through the M query and there is no conversion to string taking place
    The values where we don’t get the error are also integers hence the intriguing question is why does the error occur on a subset and not the others. I suspect there is a limit to the number of errors also somewhere internally M query is converting the column
    to text for some reason….Has someone experience the same issue? Thank you for your help John

Answers

  • Hi John,

    I’ve had a confusion like that before. Solved it by explicitely applying a Data-type Transformation to integer (Home — Transform — Data Type).

    So when you say that the columns in question are all of integer type — does that mean you’ve explicitely converted them to integer in PQ or are they «only» formatted as integer in your source system?

    Otherwise please try to identify to which step/expression your error message belongs and post it here again. It might be that one of your expressions requires an input as text format & therefore would do an indirect transformation to text (sort
    of :-)).


    Imke

    • Edited by

      Monday, July 20, 2015 9:20 AM

    • Marked as answer by
      Shiangoli
      Tuesday, July 21, 2015 5:14 PM

I’m working in an ERP reporting project and I have relatively complex PBI and PQ set with dozens of tables and processing steps.

Everything were fine until yesterday when I started to get error Expression.Error: We cannot convert the value null to type Number from several different phases of the processing steps. What makes no sense is that the phases where the error occurs is not how it normally is.

So, this is the end result from one of the tables I’m processing

janihenr_0-1619865978874.png

In the middle of the process eveything works fine. Here is the column item list I suspect is the reason for the errors:

janihenr_1-1619866080841.png

No problems there. This is the applied step #16

The next step #17 is about filtering some rows based on completely other column and which does not have anything to do with the salesorderItem column:

«= Table.SelectRows(#»Added invoicingPeriodWorkingDays», each [invoicingPeriodStarts] <= [invoicingPeriodEndDate])»

And now, when I look at the salesorderItem column after the step #17 I get :

janihenr_4-1619866504788.png

There it is. 

Anyone having seen similar behavior? Is this a memory related problem? Is there any way to get better insight what could cause this?

Jani

Понравилась статья? Поделить с друзьями:
  • Ошибка po136 форд фокус 2
  • Ошибка power query dataformat error
  • Ошибка po131 форд фокус 3
  • Ошибка power down and connect the pcie
  • Ошибка plugin is not installed