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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

extract month and year from each date (text format) using measure (data access denied)

hi everybody,

 

we had to extract month and year from each date (text format) in a table, using measure only.

We cannot access to data section to transform or add new column, the we need to add a measure to retrieve month and year from a text date.

 

So given the following table:

date_text

-------------

13/12/2020

21/12/2020

08/01/2021

17/01/2021

25/01/2021

12/02/2021

 

we need to obtain the following row using measure:

date_extraction_measure

-------------

12/2020

01/2021

02/2021

 

Thanks for your time,

SL

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous ,

Try a new column

right([date_text],7)

Anonymous
Not applicable

Hi, thanks for your answer. I cannot access to data section., then I cannot add columns. We can only add a measure.

Thanks

@Anonymous , you can get like

 

maxx(Table, right([date_text],7))

 

not sure how you want to use it

Anonymous
Not applicable

Nope! 
I need an output like this

date_extraction_measure

-------------

12/2020

01/2021

02/2021

 

with the previous formula I obtain only the max value

Hi @Anonymous ,

 

Create a measure as below:

Measure = RIGHT(MAX('Table'[Date]),7)

And you will see:

v-kelly-msft_0-1614850823762.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

Hi @v-kelly-msft ,

 

ok, but if you remove the column "Date" then only max date remains. 
I need a workaround to obtain a new column with a measure because I haven't access to data and data model.

thanks for your time,

SL

Hi @Anonymous ,

 

Measure has a context definition,without primary key,measure will be returned as a aggregated value,I dont know your actual environment,if you want it to be an actual column,you need to ask the data owner to create a calculated column or grant you the access for the data,otherwise it is impossible to simply get a column by measure without other columns for definition.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

@amitchandak 

I think that a workaround is to scroll each row and for each row extract the month.

Is there possible to do it?

 

thanks again,

SL

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.