cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CongPham Frequent Visitor
Frequent Visitor

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

Accepted Solutions
amitchandak Super Contributor
Super Contributor

Re: Convert a text measure to a date time measure

try like
 
CALCULATE( MAXx( ALLSELECTED( 'calendar'[Date] ), DATEADD('calendar'[Date_with_end_time_of_day],-1,MONTH) ) )

View solution in original post

5 REPLIES 5
amitchandak Super Contributor
Super Contributor

Re: Convert a text measure to a date time measure

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

CongPham Frequent Visitor
Frequent Visitor

Re: Convert a text measure to a date time measure

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 

amitchandak Super Contributor
Super Contributor

Re: Convert a text measure to a date time measure

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.

Highlighted
CongPham Frequent Visitor
Frequent Visitor

Re: Convert a text measure to a date time measure

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.

amitchandak Super Contributor
Super Contributor

Re: Convert a text measure to a date time measure

try like
 
CALCULATE( MAXx( ALLSELECTED( 'calendar'[Date] ), DATEADD('calendar'[Date_with_end_time_of_day],-1,MONTH) ) )

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)