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
undergreat
Frequent Visitor

Month over Month / Week over Week while filtering for specific Days

Hey PowerBi Community, 

I have a dataset with data from Google Adwords and inside the dataset I have a Week over Week and Month over Month calculation for example for Clicks. Everything works as it should. 

Here is the Custom Metric I am using for MoM:

MoM % - Clicks = 
VAR lastMonthAmount =
    CALCULATE (
        SUM ( '00 - Adwords Keyword Merge'[Clicks] ),
        FILTER (
            ALL ( 'Date' ),
            'Date'[CurMonthOffset]
                = MIN ( 'Date'[CurMonthOffset] ) - 1
        ))
RETURN
    DIVIDE ( SUM ('00 - Adwords Keyword Merge'[Clicks] ) - lastMonthAmount, lastMonthAmount, 0 )

 

Here is how it looks: 

 

 

 

But if I filter for specific weekdays, for example only Monday and Tuesday, if I would like to compare Monday this week with Monday last week, it does not work and the calculation does not make sense. Can someone please help me here and let me know what I am missing? Thank you!

Here is how it looks if I filter for Tuesday and Wednesday:


3 REPLIES 3
v-yuta-msft
Community Support
Community Support

Hi undergreat,

 

According to your screenshot, the visual level filter is based off date field, right? Then you should remove the "ALL" statement like below:

 

MoM % - Clicks = 
VAR lastMonthAmount =
    CALCULATE (
        SUM ( '00 - Adwords Keyword Merge'[Clicks] ),
        FILTER (
            ALL ( 'Date' ),
            'Date'[CurMonthOffset]
                = MIN ( 'Date'[CurMonthOffset] ) - 1
        ))
RETURN
    DIVIDE ( SUM ('00 - Adwords Keyword Merge'[Clicks] ) - lastMonthAmount, lastMonthAmount, 0 )

If issue still occurs, could you share more details(such as operations you have done), a mock-up will be super appreciated.

 

Regards,

Jimmy Tao

Hey Jimmy, 

 

thanks so much for your reply - but in your example, we still have the "ALL" clause, right? Could you help me how the measure would like without the filter?

Just removing the "ALL" makes the Measure always 0 and it's no calculation anymore.

Greg_Deckler
Super User
Super User

The reason is your ALL. Because of that you are comparing this Monday to all of last month or last week most likely. You probably need to use ALLEXCEPT instead.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.