Automatically Detect Data Types in Power BI

Leave a comment

In Power BI Desktop, we can automatically detect data types of the fields we are importing. This is useful in that we don’t need to go through every field and define its type. This feature can be turned on and off. Let’s go through an example of how to use it.

In Power BI, go to File->Options and Settings->Options:

Select Data Load, and under Type Detection you will see Automatically detect column types and headers for unstructured sources:

Power BI will now guess what the importing column type is. Now, let’s play with some data. Click on Enter Data:

Let’s type in some data, 4 columns. Power BI should be able to guess these columns:

  • Customer Name (Text)
  • Revenue (Int)
  • Date Added (Date)
  • Active (Int)

Click OK:

In the Power Query Editor, we see a step has been added after our import – Changed Type. Our data types have been set:

On clicking Advanced Editor, we see the data types have been changed:

What if our last column was actually a true/false:

In this case, Power BI sets it to a logical type:

You may want to override the default type it sets, for example, our Revenue may be a decimal number.

Let’s uncheck the option to automatically detect the data type. Now if we import another set of data:

We see the Changed Types step is not there, and Power BI does not try to detect the data type:

We can see each field has defaulted to Text:

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *