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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
telesforo1969
Helper V
Helper V

Create a date column based on two numeric fields in DirectQuery mode.

I have a table connected via DirectQuery to Power BI, and I have a numeric field (periodo) and a numeric field (Anio). With these values, I need to create a date field for data analysis. I am attaching an image of the concatenation I am doing, but it indicates that I cannot convert them unless I import the table. Is there any other way to create the date field?campo fecha directquery.JPGte the date field?

2 ACCEPTED SOLUTIONS

Ah, sorry - I missed that you're using DirectQuery mode. 
In that case you could try to add the column via SQL through the advanced connection settings instead:

KarinSzilagyi_0-1759771004336.png

KarinSzilagyi_1-1759771231046.png

Then remove the Navigation-step below your Source-Step.

View solution in original post

Hi @telesforo1969, according to the error-message the table doesn't exist in the database with that name. Are you sure that your is in the dbo-Schema? 

KarinSzilagyi_0-1759824279262.png

You can confirm which schema your table belongs to if you connect normally via the SQl-connector and check the code in the "Navigation"-step (or by checking it directly on the SQL Server if you can access it)

View solution in original post

6 REPLIES 6
SwarnaTeja
Resolver I
Resolver I

HI @telesforo1969 ,

 

Yes Direct Query Mode doesn't support data type conversions.

 

Can you try doing this conversion in the modeling tab of the report after loading the data and not in the Query Editor.

 

Hope that helps!

KarinSzilagyi
Responsive Resident
Responsive Resident

Hi @telesforo1969, Try this: 

each Date.FromText("01/"&Text.From([Periodo]) &"/"& Text.From([Anio])))

You are trying to build a string from numeric values and need to additionally transform it into a valid date. Since you're using numeric columns for Periodo and Anio you can't just string them together like text.

Ah, sorry - I missed that you're using DirectQuery mode. 
In that case you could try to add the column via SQL through the advanced connection settings instead:

KarinSzilagyi_0-1759771004336.png

KarinSzilagyi_1-1759771231046.png

Then remove the Navigation-step below your Source-Step.

I get the following error. I've checked my table name thinking that could be the error, but it's not.

campo fecha directquery 1.JPGcampo fecha directquery 2.JPG

 

Hi @telesforo1969, according to the error-message the table doesn't exist in the database with that name. Are you sure that your is in the dbo-Schema? 

KarinSzilagyi_0-1759824279262.png

You can confirm which schema your table belongs to if you connect normally via the SQl-connector and check the code in the "Navigation"-step (or by checking it directly on the SQL Server if you can access it)

 

Thank you very much, with your support I have converted two numeric fields to date in

DirectQuery Mode

crear fecha de anio y periodo directquery.png

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors