Forum Discussion

IfaZ_1's avatar
IfaZ_1
Icon for Helper I rankHelper I
2 years ago
Solved

How to Calculate Previous Month

Hi, I'm trying to calculate the previous month tickets using previousmonth function but it is showing blank. I'm not sure what is wrong. Pleaseeeee help me outttt ðŸ˜¥

 

my desired out put would be:

 

 

link of the dashboard: https://we.tl/t-c1KCSIintH

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi IfaZ_1 ,

     

    Try the expression:

    MoM Total Ticket = var _t = ADDCOLUMNS('Page 1',"Pre",SUMX(FILTER(ALL('Page 1'),YEAR([Date])=YEAR(EARLIER([Date]))&&[MonthNum]=EARLIER([MonthNum])-1),[Total Tickets]))
    RETURN MAXX(_t,[Pre])
    

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

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

3 Replies

  • IfaZ_1 , First make sure you have one separate date table for this then use PREVIOUSMONTH and reference date table date and create relation with your table

     

    PreviousMonthTickets =
    CALCULATE(
    COUNTROWS(TicketsTable),
    PREVIOUSMONTH(DateTable[Date])
    )

    • IfaZ_1's avatar
      IfaZ_1
      Icon for Helper I rankHelper I

      Why COUNTROWS? I have make a measure of total tickets. 

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi IfaZ_1 ,

         

        Try the expression:

        MoM Total Ticket = var _t = ADDCOLUMNS('Page 1',"Pre",SUMX(FILTER(ALL('Page 1'),YEAR([Date])=YEAR(EARLIER([Date]))&&[MonthNum]=EARLIER([MonthNum])-1),[Total Tickets]))
        RETURN MAXX(_t,[Pre])
        

         

        Hope it helps!

         

        Best regards,
        Community Support Team_ Scott Chang

         

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