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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.