Forum Discussion

nikkirai's avatar
nikkirai
Frequent Visitor
3 years ago
Solved

Get Count of Rows Based On User Selected Current Period

Hi all,   What I need to do is to get a countrows for the current reportingperiod and a countrows for all previous reporting periods.    The result I want is: Month: Feb Current Period: 2 Prio...
  • nikkirai's avatar
    nikkirai
    3 years ago

    Thank you amitchandak . I tweaked a little from your suggestions and it worked.


    Current Period Count = COUNT(Table1[RandomNumbers])
     
    All Prior Period Count =
    VAR _StartOfThisPeriod = FIRSTDATE('CalTable'[Date])
    VAR _EndOfThisPeriod = LASTDATE('CalTable'[Date])
    VAR _StartOfPriorPeriod = FIRSTDATE(ALL(CalTable[Date]))
    VAR _EndOfPriorPeriod = _StartOfThisPeriod-1
    RETURN
    CALCULATE(COUNT(Table1[RandomNumbers]), DATESBETWEEN('CalTable'[Date],_StartOfPriorPeriod,_EndOfPriorPeriod))