Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

How to exclude month from measure

I have data for which i created a measure that calculates the difference in revenue per month. 

SUM (revenue)-CALCULATE(SUM(revenue),PREVIOUSMONTH (date).

All 12 months are there but what i want though is to exclude September from that calculation.

 

Any ideas?

6 Replies

  • Could you please provide some sample data and the desired results from that sample.

     

    You might just need to apply a filter on your visual to exclude a specific month.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I would rather do it as a measure if possible.

       

      So i have

      Month                 Difference

      January                    50

      February                  20

      March                      75

      April                        50

      May                         10

      June                         15

      July                           20

      August                      25

      September                10

      October                     15

      November                 25

      December                 25

       

      So basically what i want is for September to be a the reset point and for the calculation of difference to start fresh. Dont know if i am explaining it clearly. 

      Thank you for taking the time to respond. If i didnt make myself clear please let me know and i will provide more details tomorrow

      • v-lid-msft's avatar
        v-lid-msft
        Icon for Community Support rankCommunity Support

        Hi Anonymous ,

         

        We can use the following measure to meet your requirement:

         

        Difference = 
        IF (
            MONTH ( SELECTEDVALUE ( 'Table'[date] ) ) = 9,
            BLANK (),
            IF (
                MONTH ( SELECTEDVALUE ( 'Table'[date] ) ) = 10,
                CALCULATE ( SUM ( 'Table'[revenue] ) ),
                CALCULATE ( SUM ( 'Table'[revenue] ) )
                    - CALCULATE ( SUM ( 'Table'[revenue] ), PREVIOUSMONTH ( 'Table'[date] ) )
            )
        )

         

        If it doesn't meet your requirement, Please show the exact expected result based on the Tables that you have shared.

         


        BTW, pbix as attached.

         

        Best regards,

        Community Support Team _ Dong Li
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.