Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
In Power Query, I encountered an issue where I had a column formatted as Whole Number. There were Null values in the column, so I added a step to replace Null with zero. After that step, somehow Power Query automatically/incorrectly changed the format of the column to Decimal Number. There is no line in the m code changing the format to decimal. Another step later in the process was expecting this column to be whole number, so I was getting a “we couldn’t convert to Number” error.
M Code:
#"Changed Type9" = Table.TransformColumnTypes(#"Sort By Date Value Then Employee ID",{{"Hire Count", Int64.Type}}), // Changed the column to Whole Number
#"Replaced Value1" = Table.ReplaceValue(#"Changed Type9",null,0,Replacer.ReplaceValue,{"Hire Count"}), // Replaced Null with Zero
#"Changed Type10" = Table.TransformColumnTypes(#"Replaced Value1",{{"Hire Count", Int64.Type}}), // Had to change the format back to Whole Number even though there is no step here that changed it to Decimal Number
This is my first post, so my apologies if I posted this to the wrong section.
Thanks, Ryan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.