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
CongPham
Helper I
Helper I

Convert a text measure to a date time measure

Hi all,

 

I have a problem with my calendar table.

I create a max_date measure, and POWER BI undrestand it is a datetime value.

Same when I create a same_max_date_last_week = max_date - 7, and POWER BI undrestand it is a datetime value, too.

But when I create a same_max_date_last_month = DATEVALUE( EDATE( [max_date], -1 ) ) & " " & TIME ( 23,59,59), the POWER BI cannot undrestand it is a datetime value, only know the measure is a text value.

 

Please take a look at my screenshoot, and the file on the link below and give me some help.

(Sorry if I'm not good at English).

Many thank!

https://drive.google.com/open?id=1vKfr26yg0lTgJk1WMTY6QL-pT0iwocLR

2019-11-29_17-44-59.png

 

1 ACCEPTED SOLUTION

try like
 
CALCULATE( MAXx( ALLSELECTED( 'calendar'[Date] ), DATEADD('calendar'[Date_with_end_time_of_day],-1,MONTH) ) )
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

If it is created as a measure, check if it can be created a column and data type can be changed in Model/table view under the modeling tab, once click on the column you will get the option.

 

Refer

 

https://community.powerbi.com/t5/Desktop/Changing-Data-Type-problem/td-p/58122

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank for your help, but my problem is the measure cannot change to datetime value in Modeling tab.

May you download my file and have some looks?

@amitchandak 

I think is DateTime value only. I am able to apply format on same.

 

same_max_date_last_week = FORMAT( [max_date] - 7,"YYYY-MM-DD")

 

The measure can be formatted in outcome you want using format.  Alignment can be changed using field formatting.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak 

The max_date_same_last_week is OK, it known as a datetime value and I can format it at Modeling tab

But the problem is the max_date_same_last_month, when I use EDATE and add TIME(23,59,59) into the measure, the system cannot undrestand it is a datetime value.

try like
 
CALCULATE( MAXx( ALLSELECTED( 'calendar'[Date] ), DATEADD('calendar'[Date_with_end_time_of_day],-1,MONTH) ) )
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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