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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Haripinnoju
Frequent Visitor

Dax query to create a calculated column date

Hi,

I have year and quarter columns, I need to create a calculated column from which I can get the date through this year and quarter columns, i.e., the date may be any either 1st of any month or in between the months.

Eg., Year 2022 quarter Q2 then date can be  04/05/2022 or 01/05/2022 etc.

 

I cannot use custom column.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Haripinnoju ,

 

Cannot use a calculated column to insert rows, the rows in the calculated column are the same as the rows in the table.

vcgaomsft_0-1686712838806.png

 

Consider creating a new table.

 

Table 2 = 
VAR _min_year =
    MIN ( 'Table'[Year] )
VAR _min_year_quarter =
    INT (
        RIGHT ( CALCULATE ( MIN ( 'Table'[Quarter] ), 'Table'[Year] = _min_year ), 1 )
    )
VAR _max_year =
    MIN ( 'Table'[Year] )
VAR _max_year_quarter =
    INT (
        RIGHT ( CALCULATE ( MIN ( 'Table'[Quarter] ), 'Table'[Year] = _min_year ), 1 )
    )
VAR _table =
    CALENDAR (
        DATE ( _min_year, 3 * _min_year_quarter - 2, 1 ),
        DATE ( _max_year, _max_year_quarter * 3, 1 )
    )
RETURN
    _table

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Haripinnoju ,

 

Cannot use a calculated column to insert rows, the rows in the calculated column are the same as the rows in the table.

vcgaomsft_0-1686712838806.png

 

Consider creating a new table.

 

Table 2 = 
VAR _min_year =
    MIN ( 'Table'[Year] )
VAR _min_year_quarter =
    INT (
        RIGHT ( CALCULATE ( MIN ( 'Table'[Quarter] ), 'Table'[Year] = _min_year ), 1 )
    )
VAR _max_year =
    MIN ( 'Table'[Year] )
VAR _max_year_quarter =
    INT (
        RIGHT ( CALCULATE ( MIN ( 'Table'[Quarter] ), 'Table'[Year] = _min_year ), 1 )
    )
VAR _table =
    CALENDAR (
        DATE ( _min_year, 3 * _min_year_quarter - 2, 1 ),
        DATE ( _max_year, _max_year_quarter * 3, 1 )
    )
RETURN
    _table

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

some_bih
Super User
Super User

Hi @Haripinnoju it seems you need to create Date table in Power BI. Check link. I hope this help https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/ 





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

Proud to be a Super User!






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.