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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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