Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 6
tarunsingla
Solution Sage
Solution Sage

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
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

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] ) )
    )
)

12.PNG

 

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.

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.
Anonymous
Not applicable

Hey! What would the formula look like if you wanted to exclude two months? For example September and June?

Hi @Anonymous ,


How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

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.

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.

Hi @Anonymous ,

 

We can use the following measure to meet your requirement:

 

Difference =
VAR skipMonth = { 9, 6 }
RETURN
    IF (
        MONTH ( SELECTEDVALUE ( 'Table'[date] ) ) IN skipMonth,
        BLANK (),
        IF (
            MONTH ( SELECTEDVALUE ( 'Table'[date] ) ) - 1 IN skipMonth,
            CALCULATE ( SUM ( 'Table'[revenue] ) ),
            CALCULATE ( SUM ( 'Table'[revenue] ) )
                - CALCULATE ( SUM ( 'Table'[revenue] ), PREVIOUSMONTH ( 'Table'[date] ) )
        )
    )

 

1.PNG

 


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.

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.