Forum Discussion

Mohan_sc's avatar
Mohan_sc
Frequent Visitor
4 years ago
Solved

Last Fiscal quarter

Hello, I have fiscal calender. I want to show data for last 1 quarter. Client fiscal quarter start for April. I've currently  using    "Last QT Ticket = CALCULATE(COUNTA('in'[ticket_number]), DAT...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Mohan_sc ,

     

    I think you can try to create a DimDate table by calendar() or calendarauto() function, then use PREVIOUSQUARTER function.

    DimDate = 
    VAR _Basic =
        ADDCOLUMNS (
            CALENDARAUTO (),
            "Year", YEAR ( [Date] ),
            "Qtr", QUARTER ( [Date] ),
            "Month", MONTH ( [Date] )
        )
    VAR _ADD_Fiscal =
        ADDCOLUMNS (
            _Basic,
            "Fiscal Year",
                IF ( [Month] >= 4, [Year], [Year] - 1 ),
            "Fiscal Qtr", IF ( [Month] >= 4, [Qtr]-1, 4 )
        )
    RETURN
        _ADD_Fiscal

    If 'in'[submit_my - Copy] is a datetime format column, you can add a date only format calculated column by DATEVALUE function. Then create a relationship between 'in'[Date] and 'Dimdate'[Date].

    Last QT Ticket = CALCULATE(COUNTA('in'[ticket_number]), PREVIOUSQUARTER(DimDate[Date]))

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.