Forum Discussion

acg's avatar
acg
Icon for Resolver I rankResolver I
5 years ago
Solved

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
  • 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:

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

    Appreciate your Kudos  !!

3 Replies

  • 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:

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

    Appreciate your Kudos  !!

  • acg's avatar
    acg
    Icon for Resolver I rankResolver 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.