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

date in text to date format

Hi  I have date in test format "Q1-2020". can I do  like this if it is"Q1-2020" date range = 01/01/2020 to 03/01/2020. If anyways I can change date Q1-2020 text in date format as coulumn in data. Please help

1 ACCEPTED SOLUTION

Hi @Anonymous 

Since the Q1 has 3 month in it , you can't change the type of "Q1-2020" from text to Date format directly.

And you can build a calendar table as I replied before and build relationships between two table's column1.

Table:

2.png

Calendar Table:

1.png

Relationship:

3.png

Build a Slicer to see the Date range for "Q1-2020"

Result:

4.png

You can download the pbix file from this link: date in text to date format

 

Best Regards,

Rico Zhou

 

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

7 REPLIES 7
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

I build a table like yours to have a test.

1.png

You may build a calendar table to achieve your goal.

Calendar =
VAR _MinYear =
    MINX ( 'Table', 'Table'[Year] )
VAR _MaxYear =
    MAXX ( 'Table', 'Table'[Year] )
RETURN
    ADDCOLUMNS (
        CALENDAR ( DATE ( _MinYear, 1, 1 ), DATE ( _MaxYear, 12, 31 ) ),
        "QTR", QUARTER ( [Date] ),
        "Year", YEAR ( [Date] ),
        "Column1",
            "Q" & ""
                & COMBINEVALUES ( "-", QUARTER ( [Date] ), YEAR ( [Date] ) )
    )

Result:

2.png

You can download the pbix file from this link: date in text to date format

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

mahoneypat
Employee
Employee

Do you want a different text value in same row that shows "1/1/2020-3/31/2020"?  Or you want to generate a table of dates over that range?

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi

 

thanx for understanding. Yes I want to generate column/table over the date range in date format 

Hi @Anonymous 

Since the Q1 has 3 month in it , you can't change the type of "Q1-2020" from text to Date format directly.

And you can build a calendar table as I replied before and build relationships between two table's column1.

Table:

2.png

Calendar Table:

1.png

Relationship:

3.png

Build a Slicer to see the Date range for "Q1-2020"

Result:

4.png

You can download the pbix file from this link: date in text to date format

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Hi @Anonymous 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


Best Regards,

Rico Zhou

pranit828
Community Champion
Community Champion

Hi @Anonymous 

 

measure1 = 
VAR year = RIGHT(Table[date in test format],4)
RETURN
SWITCH(LEFT(Table[date in test format],2),"Q1","01/01/"&[year]&" to 03/01/"&[year],
                                           "Q2","04/01/"&[year]&" to 06/01/"&[year],
                                           "Q3","07/01/"&[year]&" to 09/01/"&[year],
                                           "Q4","10/01/"&[year]&" to 12/01/"&[year])

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

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.