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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Convert Measure Text type into Date-Time Type

I have written 2 measures which gives me date value and time value.

 

 

SelectedDate = SELECTEDVALUE(New[BEGIN_DATE])

 

 

SelectedTime = SELECTEDVALUE(DateRange[TimeRange])

these both data type is date and time.

 

But when i try to combine these both measure values as below

 

 

Selected Date-Time Range = [SelectedDate]&" "&[SelectedTime]

It is becoming type text and i cant even change the type to date-time(DD:MM:YYYY HH:MM:SS TT)

 

I tried with TRUNC function from here

https://www.sqlbi.com/blog/marco/2016/12/06/format-measures-as-dates-in-power-bi-dax-powerbi/

 

Selected Date-Time Range = TRUNC([SelectedDate]&" "&[SelectedTime])+DATE ( 1899, 12, 30 )

Well it is getting converted into date-time type but here im missing the time values

Capture.JPG

 

 

Can anyone please help to get this done.

 

Thanks You.

Mohan V

 

 

9 REPLIES 9
johnt75
Super User
Super User

Try

SELECTEDVALUE ( Table[Date] ) + SELECTEDVALUE ( Table[Time] )
Anonymous
Not applicable

Thank you. Giving it a shot. Much appreciated.

uk_tj
Advocate IV
Advocate IV

Bit late but try adding the date to the time...

prateekraina
Memorable Member
Memorable Member

Hi @Anonymous,

 

Here is the required DAX.

DateTime =
DATEVALUE (
    SELECTEDVALUE ( Table[Date] ) & " " & SELECTEDVALUE ( Table[Time] )
)

Enjoy !!

 

Prateek Raina

Anonymous
Not applicable

@prateekraina thanks for the reply

 

i tried this but didnt worked.

Selected Date-Time Range = 
DATEVALUE (
    SELECTEDVALUE ( New[BEGIN_DATE] ) & " " & SELECTEDVALUE(DateRange[TimeRange]))

Capture.JPG

 

Not giving the time value.

 

 

Hi @Anonymous,

 

Check out this short video. You can achieve this in the Power Query Editor itself.

No need for DAX measures.

 

Prateek Raina

Anonymous
Not applicable

Well thanks for the suggestion @prateekraina.

I know we can achive this by power query and DAX calculated column.

I have done that already.

 

But for my requirement, i have to go with the measures only.

 

If you have time then go with the detaield explantion of what im trying to achive

https://community.powerbi.com/t5/Desktop/How-to-create-Dynamic-Date-Time-Range/m-p/482159

 

Thanks,

 

Mohan V

 

 

HI @Anonymous,

 

This is some problem statement 🙂

Can you tell me what is the reason you want the concatenated column to have a DateTime data type and not Text?

 

Prateek Raina

Anonymous
Not applicable

Irrelevant. Just answer his question. That's what he needs. Why do you ask him to justify? Absurd. Either provide an answer or don't respond. Simple.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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 Solution Authors
Top Kudoed Authors