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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

How to get Year and Quarter recognized as date?

Hi, 

 

I have quarter and year in my data set. I want PowerBI to recognize and deal with these as a date (Time Intelligence, Drill Down etc., Hierarchies etc). 

 

How do I do this? 

Thanks!

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please refer to my pbix filw to see if it helps you.

Create a column.

date_ =
VAR _year =
    LEFT ( MAX ( 'Table'[YearQua] ), 4 ) & "/"
VAR _right =
    RIGHT ( 'Table'[YearQua], 1 )
VAR _date =
    IF (
        _right = "1",
        "1/1",
        IF (
            _right = "2",
            "4/1",
            IF ( _right = "3", "7/1", IF ( _right = "4", "10/1", BLANK () ) )
        )
    )
RETURN
    _year & _date

Then change the column type.

vpollymsft_0-1652684855326.png

Then click OK.

vpollymsft_1-1652684867922.png

vpollymsft_2-1652684922680.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

Please refer to my pbix filw to see if it helps you.

Create a column.

date_ =
VAR _year =
    LEFT ( MAX ( 'Table'[YearQua] ), 4 ) & "/"
VAR _right =
    RIGHT ( 'Table'[YearQua], 1 )
VAR _date =
    IF (
        _right = "1",
        "1/1",
        IF (
            _right = "2",
            "4/1",
            IF ( _right = "3", "7/1", IF ( _right = "4", "10/1", BLANK () ) )
        )
    )
RETURN
    _year & _date

Then change the column type.

vpollymsft_0-1652684855326.png

Then click OK.

vpollymsft_1-1652684867922.png

vpollymsft_2-1652684922680.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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

HotChilli
Super User
Super User

I see that you are not following my example.

First of all, get the datatypes right.  These 'Any' datatypes are not really useful for further data manipulations.  You can fix this by selecting all columns and choosing Detect Data Type from the Transform menu.

Then Add a custom column to make a month number. This will be the 'if' statement (similar to my first post above).

Then add another custom column using #date to construct the date from the 3 columns you have.  You can experiment by hardcoding the values to see how it works e.g. : #date(2020,3,1).  If you make this work, substitute the column names for each number (in the correct place)

HotChilli
Super User
Super User

Combine the values (with 1 for the day) in a custom column in Power Query.

You can make a date in the following way : 

#date(year as number, month as number, day as number)

You will probably have to write an 'if' statement to get a month from the quarter e.g if quarter = "q2" then 4

Anonymous
Not applicable

Thanks for your help. I still have not quite managed to get that to work.

How would you do it for following example?

 

Thank you!

NL12000_0-1652272337080.png

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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