Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
intrasight
Helper IV
Helper IV

Table columns lose their data types after a Table.AddColumn() statment

I pull in some metrics with the GA connector. Then immediately following, I have this statement to turn ga:yearMonth into a date

 

#"Inserted Date" = Table.AddColumn(#"Added Items", "RecordDate", each Date.From(Text.Middle([Month of Year],0,4) & "-" & Text.Middle([Month of Year],4,2) & "-01"), type date)

 

Before adding that statement, all of the GA metrics columns have correct data types. After adding that statement, all the metric column have switched to type "Any". Am I doing something wrong in my Table.AddColumn() that is causing this?  Is this a Power Query bug? Expected behavior? Hope not since it would really be a pain to have to unecessarily re-type all of the columns in the query.

6 REPLIES 6
davidcox
Frequent Visitor

Hi,

 

This issue also occurs when manually editing a replace values step in the formula bar. Typically replacing a column with conditional information in another column.

 

All data types become "any" abc123

 

Kind Regards

David

davidcox
Frequent Visitor

The issue also occurs on manually editing the formular bar after introducing a replace values step

Baskar
Resident Rockstar
Resident Rockstar

can u please give me the entire power Query

let
    Source = GoogleAnalytics.Accounts(),
    #"Account" = Source{[Id="xxx"]}[Data],
    #"Site" = #"Account"{[Id="yyy"]}[Data],
    #"View" = #"Site"{[Id="zzz"]}[Data],
    #"Added Items" = Cube.Transform(#"View", 
       {
          {Cube.AddAndExpandDimensionColumn, "ga:yearMonth", {"ga:yearMonth"}, {"Month of Year"}}, 
          {Cube.AddMeasureColumn, "Pageviews", "ga:pageviews"},
          {Cube.AddMeasureColumn, "Avg. Time on Page", "ga:avgTimeOnPage"}, 
          {Cube.AddMeasureColumn, "Entrances", "ga:entrances"}, 
          {Cube.AddMeasureColumn, "Unique Pageviews", "ga:uniquePageviews"}
       }
    ),
   // parse GAs YYYYMM into a date
   #"Inserted Date" = Table.AddColumn(#"Added Items", "RecordDate", each Date.From(Text.Middle([Month of Year],0,4) & "-" & Text.Middle([Month of Year],4,2) & "-01"), type date)
in
    #"Inserted Date"

Replace "xxx","yyy","zzz" with your GA IDs.

Note that after adding the new date column that the types of existing columns are lost.

Q: why is this formum injecting a "smiley tongue" into my code?

What kind of connection you are using ?

Direct or Import ?

Using the native Google Analytics connector

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors