cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
naledi_h
Helper I
Helper I

Cannot convert value null to text - pivot

I have a reasonably complex workflow with several tables and am getting the error below. Unfortunately,  I cannot share the workbook or data. 

 

naledi_h_0-1669586194641.png

I checked this thread but couldn't find a solution:  https://community.powerbi.com/t5/Power-Query/Expression-Error-We-cannot-convert-the-value-null-to-ty... 


This error appeared after one change on "Metadata-Responses", where I replaced the 0 values will null (so it now has values 1-5 and null). This then caused the error two tables down the line, even thought the field that is altered in the first table is only used there and then deleted in the following table. The error appears on the very last step, which is a pivot  

naledi_h_1-1669586933554.png

Data that the pivot is performed on 

naledi_h_2-1669587068540.png


Pivot settings

naledi_h_3-1669587105209.png

 

  •  The error does not appear when I delete the pivot step (but it causes a bunch of other errors because the data model doesn't work anymore) 
  • The pivot worked fine before I added the one transformation step to the field two tables previous to this one and on a field that is no longer present in this table 
  • I checked every step in these three tables to see if there is another error somewhere but there are none
  • The altered field is not used in any other actions within Power Query 

 

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

Hi @naledi_h ,

According to your description, I reproduce your problem.

If there is null in the column, after pivot the column, the same error occures.

vkalyjmsft_0-1669626367030.png

vkalyjmsft_1-1669626450979.png

I think it's because after pivot, values in Column1 will be column names, but the null value cannot be used in column name.

As a workaroud, in the replace value step, replace 0 with text "null" instead of null, directly add Double quotes “” to null in the code.

vkalyjmsft_2-1669626795910.png

After pivot, the error disappears.

vkalyjmsft_3-1669626908687.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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-kalyj-msft
Community Support
Community Support

Hi @naledi_h ,

According to your description, I reproduce your problem.

If there is null in the column, after pivot the column, the same error occures.

vkalyjmsft_0-1669626367030.png

vkalyjmsft_1-1669626450979.png

I think it's because after pivot, values in Column1 will be column names, but the null value cannot be used in column name.

As a workaroud, in the replace value step, replace 0 with text "null" instead of null, directly add Double quotes “” to null in the code.

vkalyjmsft_2-1669626795910.png

After pivot, the error disappears.

vkalyjmsft_3-1669626908687.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors