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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
acg
Resolver I
Resolver I

Last Quarter dates (distinct) needed

For a time calender I need the comparable 9distinct) last day of the quarter of the last quarter. 

 

I am trying this, but not sure what neeeds to e changed:

 

CompareDateQuarter = DATEADD( DISTINCT(Dates[first_day_of_last_quarter]),-1, QUARTER)
 
Any ideas are welcome
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @acg 

If you want to find the last day of the last quarter based on Today Date (or any specific date), you can use the below code:

CompareDateQuarter =
VAR _Today =
    TODAY ()
RETURN
    VAR _LastQuarter =
        QUARTER ( _Today ) - 1
    RETURN
        VAR _LastQMonth = _LastQuarter * 3
        RETURN
            DATE ( YEAR ( _Today ), _LastQMonth + 1, 1 ) - 1

 

The output will be as below:

VahidDM_0-1628642444817.png

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

Appreciate your Kudos VahidDM_1-1628642514850.png !!

View solution in original post

3 REPLIES 3
CNENFRNL
Community Champion
Community Champion

Screenshot 2021-08-11 151542.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

acg
Resolver I
Resolver I

Need to see, whether I can rework this with a dynamic quater date-  in other words, it needs to work with any quarter date. 

VahidDM
Super User
Super User

Hi @acg 

If you want to find the last day of the last quarter based on Today Date (or any specific date), you can use the below code:

CompareDateQuarter =
VAR _Today =
    TODAY ()
RETURN
    VAR _LastQuarter =
        QUARTER ( _Today ) - 1
    RETURN
        VAR _LastQMonth = _LastQuarter * 3
        RETURN
            DATE ( YEAR ( _Today ), _LastQMonth + 1, 1 ) - 1

 

The output will be as below:

VahidDM_0-1628642444817.png

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

Appreciate your Kudos VahidDM_1-1628642514850.png !!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.