Setting Data Types When Building Table Values In Power BI

Chris Webb shows how to use a parameter on the Table.AddColumn function in M to define specific data types:

In the last two screenshots the ABC123 icon in the column headers show that they are set to use the Any data type; the columns returned by calling the function have lost their data types.

The key to solving this problem is using the optional fourth parameter of the Table.AddColumn() function, which allows you to set a data type for the column that function adds to a table. Altering the Invoked Custom Function step of the previous query to do this, setting the new column to be a table type like so:

Worth reading in its entirety.

Related Posts

AWS Glue Now Supports Scala

Mehul Shah, et al, announce that AWS Glue officially supports Scala: We are excited to announce AWS Glue support for running ETL (extract, transform, and load) scripts in Scala. Scala lovers can rejoice because they now have one more powerful tool in their arsenal. Scala is the native language for Apache Spark, the underlying engine that AWS […]

Read More

Visuals I Like

I continue my series on dashboard visualization: This leads me to a little bit of advice for choosing bars versus columns.  You will want to choose a bar chart if the following are true: Category names are long, where by “long” I mean more than 2-3 characters. You have a lot of categories. You have relatively few […]

Read More

Categories

September 2017
MTWTFSS
« Aug Oct »
 123
45678910
11121314151617
18192021222324
252627282930