Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Current Quarter and last quarter calculation

Dear Team, need some help.   I have a Sales amount ranging from May 30' 2019 till Jan 01' 2017. How do I get the current quarter total sales and last quarter total sales? the previous quarter formu...
  • v-xicai's avatar
    7 years ago

    Hi Anonymous ,

     

    You can create Quarter column first of all.

     

    Quarter = ROUNDUP(MONTH(Table1[Date])/3,0)

     

    Then create measures to get the current quarter total sales and last quarter total sales.

     

    Total sales_current quarter = CALCULATE(SUM(Table1[sale]),FILTER(ALLSELECTED(Table1), Table1[Quarter] =MAX(Table1[Quarter])))

     

    Total sales_last quarter = CALCULATE(SUM(Table1[sale]),FILTER(ALLSELECTED(Table1), Table1[Quarter] =MAX(Table1[Quarter])-1))

     

    Best Regards,

    Amy

     

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

     

  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous ,

     

    You can make this small change to the Quarter computation

     

    Quarter =Year(Table1[Date])*4 +  ROUNDUP(MONTH(Table1[Date])/3,0)

     

     

    What this will result is a running serial number for the quarters  from  8069 for Jan - March 2017 - 1st quarter and so on until 8079 - for Apr-May 2019 - 2 quarter.

     

    Use the formula as suggested by v-xicai  for current quarter and previous quarter. It will work.

     

    Check it out.

     

    Cheers

     

    CheenuSing