Forum Discussion

pfeigl's avatar
pfeigl
New Member
5 years ago

Pivot data and change datatype based on type column

Ok, the title is a little complicated, but here goes the data I actually have:

 

 

I'd like to do two things

- pivot the result, so that the "ComponentNameModeSession" column is used as columns

- use the values in the "Type" column to change the datatype of the resulting columns

 

Is this possible? 

 

When doing the pivot, I get one row per "Type", because it can obviously not group on it. 

I can fix this, by removing the Type column first - this gives me the expected pivot result, however without the type column, I have no way to do the data transformation to actual dates, numbers and texts.

 

Thanks for your help,

Philipp

 

1 Reply

  • edhans's avatar
    edhans
    Community Champion

    I am not aware of a way to type the columns after they have been pivoted. They retain their pre-pivot types. You would need to change the type after it was done. If you know what the types need to be based on column name, I suppose you could use Expression.Evaluate or Expression.Identifier to do those change for you, but I would need some data to play with in a usable format.

     

    How to get good help fast. Help us help you.
    How to Get Your Question Answered Quickly
    How to provide sample data in the Power BI Forum