Forum Discussion

adamjclee's avatar
adamjclee
New Member
3 years ago

Power Query: Always getting DataFormat.Error We couldn't convert to Number

I'm new to using Power Query and I seem to always get error:DataFormat.Error We couldn't convert to Number. This seems to happen when it really shouldn't so I'd be grateful for an explanation. For example:

 

I have the following data:

 

As can be seen, dep_delay is a column of numbers and carrier is a text column. If I try to Pivot on carrier, with dep_delay as value and aggregation function Average, I get a DataFormat.Error We couldn't convert to Number. This is non-sensical to me - everything that needs to be is already of type number.  I get the same error if I try to close and load the query.

 

Worth noting is that, if I simply import the Table from csv using get and transform - but not the PQ editor - the data loads correctly and I can do this pivot etc. in Excel with absolutely no issues - suggesting something strange is going on in PQ. (Perhaps worth mentioning is that I'm using PQ on a mac).

 

Grateful for any suggestions as to why this might be occuring.

 

5 Replies

    • adamjclee's avatar
      adamjclee
      New Member

      Sure. First here is the pivot options box.

       

      When I click on OK, I get the following:

      • rajulshah's avatar
        rajulshah
        Resident Rockstar

        adamjclee 

        We are taking average of the values. But since it has "true" value it cannot take the average.

        You can take min or max.

        Please let me know if this didn't work.