Forum Discussion

JulienH's avatar
JulienH
Regular Visitor
6 years ago
Solved

Count previous quarter

Hi all,   I am trying to count the numbers of entries in (excel online database) for my previous quarter. If I compare Q1 - 2016 (52 entries) to my Q2 - 2016 previous quarter (30 entries) the amoun...
  • JulienH's avatar
    6 years ago

    The issue I was having was because i was not using a table calendar which i created using this code.

     

    DimDates = 
    VAR BaseCalendar = 
        CALENDARAUTO (3)
    RETURN
        GENERATE(
            BaseCalendar,
            VAR BaseDate = [Date]
            VAR YearDate = YEAR(BaseDate)
            VAR MonthNumber = MONTH(BaseDate)
            RETURN ROW (
                "Day", BaseDate,
                "Year", YearDate,
                "Month Number", MonthNumber,
                "Month", FORMAT(BaseDate, "mmmm"),
                "Year Month", FORMAT(BaseDate, "mmm yy")
                )
            )

    Once i had that table and linked it to my other tables everything came together.

     

    Article previous quarter = CALCULATE(COUNT('Article Tracker'[Article]),PREVIOUSQUARTER(DimDates[Date]))