Forum Discussion

benjaminlperry's avatar
benjaminlperry
Frequent Visitor
7 years ago
Solved

Last Date Previous Quarter

So I have a table (KPIs) with completed dates.  I was easily able to get a calculated column for the most recent date......

 

Is_LastDate = IF(KPIs[date_completed] = MAX(KPIs[date_completed]), 1, 0)

 

However, I now want another calculated column that does the same thing, but for the last date in the previous quarter.  It would look like this. 

 

date_completed        Is_LastDatePrevQtr

7/15/2019                              0

6/2/2019                                0

5/15/2019                              0

3/30/2019                              1

2/15/2019                              0

1/13/2019                             0

 

I can't figure out the DAX though.  

  • Anonymous's avatar
    Anonymous
    7 years ago

    HI benjaminlperry ,

    I think you can use date function to calculate with date fields to find out specific date who added three months(one quarter) equal to max date.

    PrevLastdate =
    IF (
        DATE ( YEAR ( 'Table'[Date] ), MONTH ( 'Table'[Date] ) + 3, DAY ( 'Table'[Date] ) )
            = MAX ( 'Table'[Date] ),
        1,
        0
    )
    

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI benjaminlperry ,

    I think you can use date function to calculate with date fields to find out specific date who added three months(one quarter) equal to max date.

    PrevLastdate =
    IF (
        DATE ( YEAR ( 'Table'[Date] ), MONTH ( 'Table'[Date] ) + 3, DAY ( 'Table'[Date] ) )
            = MAX ( 'Table'[Date] ),
        1,
        0
    )
    

    Regards,

    Xiaoxin Sheng