Forum Discussion

IfaZ_1's avatar
IfaZ_1
Helper I
1 year ago

Previous Month Calculation

Hi, 

 

I'm running a the end of blocked road here. I have tried several times and still my calculation didnt appear. 

this is the calculation I made : 

MoM Total Ticket =
    CALCULATE(
        [Total Tickets],
        PREVIOUSMONTH('FY Date'[Date])
    )
 
The result and my relationship tables

 

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi IfaZ_1 ,

     

    Thanks to Irwan , Dangar332  and some_bih for their quick replies. I have some other thoughts to add:

    (1) We can create a column on [FY Date] table.

    Month_num = MONTH([Date])

    (2) We can create a measure.

    MoM Total Ticket = 
        CALCULATE(
            [Total Tickets],
            FILTER(ALL('FY Date'),[Month_num]=MAX('FY Date'[Month_num])-1)
        )

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

    • IfaZ_1's avatar
      IfaZ_1
      Helper I
      here is my measure for
       
      Total Tickets = SUM('Page 1'[DNME]) + SUM('Page 1'[SLAEE]) + SUM('Page 1'[Open]) + SUM('Page 1'[SLAME])
  • Dangar332's avatar
    Dangar332
    Resident Rockstar

    HI, IfaZ_1 

    Try below measure

    MoM Total Ticket =
    var previous_month = maxx(
    filter(
    all('FY Date'[Month]),
    'FY Date'[Month]<min('FY Date'[Month])
    ))
    return
     CALCULATE(
            [Total Tickets],
            'FY Date'[Month]=previous_month
        )
    

     

    Best Regards,
    Dangar

     

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

     

    • IfaZ_1's avatar
      IfaZ_1
      Helper I

      Hi Dangar, 

       

      It is giving me this error 

       

       

      • Dangar332's avatar
        Dangar332
        Resident Rockstar
        MoM Total Ticket =
        var previous_month = maxx(
        filter(
        all('FY Date'[Month]),
        'FY Date'[Month]<min('FY Date'[Month])
        ),'FY Date'[Month])
        return
         CALCULATE(
                [Total Tickets],
                'FY Date'[Month]=previous_month
            )