cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
martijnth Helper II
Helper II

Direct Query - transform Date TIme to Date

Dear Reader,

I'm trying to confert a Desktop Dashboard to a Direct Query Dashoard since I could not find a proper way to refresh every 15 minutes automatically. Now in Desktop i used the following DAX code:

Shift_date = format(if((TBM_PRODUCTION_DATA[ProducedOn]-TBM_PRODUCTION_DATA[ProducedOn].[Date])<0.25,TBM_PRODUCTION_DATA[ProducedOn].[Date]-1,TBM_PRODUCTION_DATA[ProducedOn].[Date]),"dd-mm-yyyy")

In direct querry in cannot use the Format command, so I tried to change the format (ribbon) from Date/time (1/25/2019 1:23:29 PM) to Date (1/25/2019) when i plot the result in a table it actually only shows the Date, BUT when i plot as x-as in a graph all of a sudden it does not have seem to forgetten the time. I appreciate all solutions.

reg martijn

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft v-danhe-msft
Microsoft

Re: Direct Query - transform Date TIme to Date

Hi @martijnth,

Could you have tried use the measure with FORMAT function? Based on my test, it could work on my side:

1.PNG

You can use the Format function in DQ mode if you go to Options -> DirectQuery and click "Allow unrestricted measures in DirectQuery mode".  Note that this will enable other functions whose performance is poor in DirectQuery mode, so save often.

 

Regards,

Daniel He

 

 

Community Support Team _ Daniel He
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
Highlighted
Microsoft v-danhe-msft
Microsoft

Re: Direct Query - transform Date TIme to Date

Hi @martijnth,

Could you have tried use the measure with FORMAT function? Based on my test, it could work on my side:

1.PNG

You can use the Format function in DQ mode if you go to Options -> DirectQuery and click "Allow unrestricted measures in DirectQuery mode".  Note that this will enable other functions whose performance is poor in DirectQuery mode, so save often.

 

Regards,

Daniel He

 

 

Community Support Team _ Daniel He
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

martijnth Helper II
Helper II

Re: Direct Query - transform Date TIme to Date

Hi Daniel, thanks for your support, I made the changes in the options however, now I get the following notice:

 

frmt pbi.jpg

 

something similar happens when I try to use RELATE in direct query:

rltd pbi.jpg

the relation between the direct query SQL and the Related Excel is there....

 

Any advise is appreciated.

reg martijn

 

 

martijnth Helper II
Helper II

Re: Direct Query - transform Date TIme to Date

copied wrong picture above,rltd 2 pbi.jpg

 

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors