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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
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.