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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
telesforo1969
Contributor II

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.



Did I answer your question? If so, please consider marking my response as the โ€˜Accepted Solutionโ€™ - it helps others with the same issue find the answer more easily!

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)



Did I answer your question? If so, please consider marking my response as the โ€˜Accepted Solutionโ€™ - it helps others with the same issue find the answer more easily!

View solution in original post

6 REPLIES 6
KarinSzilagyi
Contributor III

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.



Did I answer your question? If so, please consider marking my response as the โ€˜Accepted Solutionโ€™ - it helps others with the same issue find the answer more easily!

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.



Did I answer your question? If so, please consider marking my response as the โ€˜Accepted Solutionโ€™ - it helps others with the same issue find the answer more easily!

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)



Did I answer your question? If so, please consider marking my response as the โ€˜Accepted Solutionโ€™ - it helps others with the same issue find the answer more easily!

 

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

SwarnaTeja
New Contributor III

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!

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.

Users online (14,766)