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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
maurcoll
Helper IV
Helper IV

Changing a data type in a custom column in direct query

Hi

I have a model that is using some tables that have been imported and some that are direct query. Due to the volume of data and how frequently i need it to refresh the tables that are direct query need to remain as direct query and the others to stay as import.


I have added a custom column to one of the direct query tables and i need to amend the type to whole number, when i do this i get a message to say: This step results in a query not supported in directquery mode switch all tables to import mode.

Is there a way i can change the data type

This is the custom column i have created

if [hour] = 7 then 0 else if [hour] = 8 then 1 else if [hour] = 9 then 2 else if [hour] = 10 then 3 else if [hour] = 11 then 4 else if [hour] = 12 then 5 else if [hour] = 13 then 6 else if [hour] = 14 then 7

and so on for the day

i need to show the hour sorted so it starts at 7 on a chart/matrix

2 ACCEPTED SOLUTIONS
vojtechsima
Super User
Super User

Hello, @maurcoll ,

given you have your SQL column that gives your the 0-7 value, you can either create another one, inverted 0--7 and sort your original column based on that.

Or create manual dimension like this:

vojtechsima_0-1730979361903.pngvojtechsima_1-1730979373671.png

and then it's gonna be automatically sorted:

vojtechsima_2-1730979393611.png


don't forget to create relationship to your DirectQuery table and use dimension for the field in Visual





โœ”
Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

View solution in original post

Anonymous
Not applicable

Thanks for the reply from vojtechsima , please allow me to provide another insight:

Hi, @maurcoll 
 

You are correct. Based on my testing, attempting to convert the type to a whole number, which corresponds to Int64.Type in M language, is indeed unsupported in Power Query.

vlinyulumsft_0-1731043376580.png

Therefore, we recommend converting your required custom column to a decimal number, which is represented as "number" in M language.

vlinyulumsft_1-1731043376580.png

For further details, please refer to the documentation.
Int64.From - PowerQuery M | Microsoft Learn

DirectQuery in Power BI - Power BI | Microsoft Learn

 

In your case, both of these data types can meet your requirements. Here is a screenshot from the official documentation:

vlinyulumsft_2-1731043408359.png

For more information, please consult the documentation.

Solved: Number vs Int64.type - Microsoft Fabric Community

 

Moreover, even though you cannot directly change the type to whole number in Power Query, you can select the column in the desktop version and modify it using the Column Tools.

vlinyulumsft_3-1731043408360.png

vlinyulumsft_4-1731043431614.png

Below are the final results, and I hope they meet your needs:

vlinyulumsft_5-1731043431615.png


Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks for the reply from vojtechsima , please allow me to provide another insight:

Hi, @maurcoll 
 

You are correct. Based on my testing, attempting to convert the type to a whole number, which corresponds to Int64.Type in M language, is indeed unsupported in Power Query.

vlinyulumsft_0-1731043376580.png

Therefore, we recommend converting your required custom column to a decimal number, which is represented as "number" in M language.

vlinyulumsft_1-1731043376580.png

For further details, please refer to the documentation.
Int64.From - PowerQuery M | Microsoft Learn

DirectQuery in Power BI - Power BI | Microsoft Learn

 

In your case, both of these data types can meet your requirements. Here is a screenshot from the official documentation:

vlinyulumsft_2-1731043408359.png

For more information, please consult the documentation.

Solved: Number vs Int64.type - Microsoft Fabric Community

 

Moreover, even though you cannot directly change the type to whole number in Power Query, you can select the column in the desktop version and modify it using the Column Tools.

vlinyulumsft_3-1731043408360.png

vlinyulumsft_4-1731043431614.png

Below are the final results, and I hope they meet your needs:

vlinyulumsft_5-1731043431615.png


Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

vojtechsima
Super User
Super User

Hello, @maurcoll ,

given you have your SQL column that gives your the 0-7 value, you can either create another one, inverted 0--7 and sort your original column based on that.

Or create manual dimension like this:

vojtechsima_0-1730979361903.pngvojtechsima_1-1730979373671.png

and then it's gonna be automatically sorted:

vojtechsima_2-1730979393611.png


don't forget to create relationship to your DirectQuery table and use dimension for the field in Visual





โœ”
Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

Thank you , i created a new dimension table and that has worked

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.