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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
aditi1997yadav
Frequent Visitor

Month on Month change

Negative Volume MoM% 2 =

IF(

ISFILTERED('categorysubcategoryVolume'[CombinedDate]),

ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),

VAR __PREV_MONTH =

CALCULATE(

SUM('categorysubcategoryVolume'[Negative Volume]),

DATEADD('categorysubcategoryVolume'[CombinedDate].[Date], -1, MONTH)

)

RETURN

DIVIDE(

SUM('categorysubcategoryVolume'[Negative Volume]) - __PREV_MONTH,

__PREV_MONTH

)

)

 

I AM USING THIS DAX FOR MOM change , but my slicer has text values of dates which are in hierarchy format to make a default dynamic selection. so my mom change dax is not able to read the selection. how do i make this work ? i donot want to change my date filter in any way..  i tried creating a copy of the dates in the filter which are in the same table, but that does not seem to work either. 

2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @aditi1997yadav 

As a best practice and simplify time intelligence calculation, please use a separate dates table, you can create one in DAX or in M. Below is a sample DAX calc table.

CalendarTable =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2030, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "Month Name", FORMAT ( [Date], "MMMM" ),
    "Month Short Name", FORMAT ( [Date], "MMM" ),
    "Quarter", "Q" & QUARTER ( [Date] ),
    "Quarter Number", QUARTER ( [Date] ),
    "Week Number", WEEKNUM ( [Date] ),
    "Day", DAY ( [Date] ),
    "Day of Week", WEEKDAY ( [Date] ),
    "Day Name", FORMAT ( [Date], "dddd" ),
    "Day Short Name", FORMAT ( [Date], "ddd" ),
    "Is Weekday", IF ( WEEKDAY ( [Date], 2 ) <= 5, TRUE, FALSE ),
    "Year-Month", FORMAT ( [Date], "YYYY-MM" ),
    "Year-Quarter",
        FORMAT ( [Date], "YYYY" ) & "-Q"
            & QUARTER ( [Date] ),
    "Fiscal Year",
        IF ( MONTH ( [Date] ) >= 7, YEAR ( [Date] ) + 1, YEAR ( [Date] ) ),
    "Fiscal Quarter",
        "Q"
            & MOD ( QUARTER ( [Date] ) + 2, 4 ) + 1,
    "Day of Year", DATEDIFF ( DATE ( YEAR ( [Date] ), 1, 1 ), [Date], DAY ) + 1
)

Create a one-to-many single direction relationship from that to the fact table and mark it as date table

danextian_1-1734952068515.png

 

Disable Auto date/time

danextian_0-1734952010297.png

 

Create a measure similar to below:

Sales Previous  Month = 
CALCULATE( [Sales], PREVIOUSMONTH ( 'Date'[Date] ) )

 

Refer to the attached pbix for the details.

 

Otherwise, please post a workable sample data (not ang image) and your expected result from that.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

Anonymous
Not applicable

Thanks for the reply from danextian.

 

Hi @aditi1997yadav ,

 

Based on your description, I created sample data:

vlinhuizhmsft_0-1735537817281.png

 

The fields used by the slicer are as follows:

vlinhuizhmsft_1-1735537957227.png

 

1. Create a similar new column:

Column = DATE('Date_slicer'[Year], SWITCH('Date_slicer'[Month], 
    "January", 1, 
    "February", 2, 
    "March", 3, 
    "April", 4, 
    "May", 5, 
    "June", 6, 
    "July", 7, 
    "August", 8, 
    "September", 9, 
    "October", 10, 
    "November", 11, 
    "December", 12), 
    'Date_slicer'[Day])

vlinhuizhmsft_2-1735538012126.png

 

2. Create a new table:

vlinhuizhmsft_3-1735538141928.png

 

3. Create the following relationship:

vlinhuizhmsft_4-1735538210798.png

 

4. Result:

vlinhuizhmsft_5-1735538250979.png

 

 

Best Regards,
Zhu

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks for the reply from danextian.

 

Hi @aditi1997yadav ,

 

Based on your description, I created sample data:

vlinhuizhmsft_0-1735537817281.png

 

The fields used by the slicer are as follows:

vlinhuizhmsft_1-1735537957227.png

 

1. Create a similar new column:

Column = DATE('Date_slicer'[Year], SWITCH('Date_slicer'[Month], 
    "January", 1, 
    "February", 2, 
    "March", 3, 
    "April", 4, 
    "May", 5, 
    "June", 6, 
    "July", 7, 
    "August", 8, 
    "September", 9, 
    "October", 10, 
    "November", 11, 
    "December", 12), 
    'Date_slicer'[Day])

vlinhuizhmsft_2-1735538012126.png

 

2. Create a new table:

vlinhuizhmsft_3-1735538141928.png

 

3. Create the following relationship:

vlinhuizhmsft_4-1735538210798.png

 

4. Result:

vlinhuizhmsft_5-1735538250979.png

 

 

Best Regards,
Zhu

 

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

danextian
Super User
Super User

Hi @aditi1997yadav 

As a best practice and simplify time intelligence calculation, please use a separate dates table, you can create one in DAX or in M. Below is a sample DAX calc table.

CalendarTable =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2030, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "Month Name", FORMAT ( [Date], "MMMM" ),
    "Month Short Name", FORMAT ( [Date], "MMM" ),
    "Quarter", "Q" & QUARTER ( [Date] ),
    "Quarter Number", QUARTER ( [Date] ),
    "Week Number", WEEKNUM ( [Date] ),
    "Day", DAY ( [Date] ),
    "Day of Week", WEEKDAY ( [Date] ),
    "Day Name", FORMAT ( [Date], "dddd" ),
    "Day Short Name", FORMAT ( [Date], "ddd" ),
    "Is Weekday", IF ( WEEKDAY ( [Date], 2 ) <= 5, TRUE, FALSE ),
    "Year-Month", FORMAT ( [Date], "YYYY-MM" ),
    "Year-Quarter",
        FORMAT ( [Date], "YYYY" ) & "-Q"
            & QUARTER ( [Date] ),
    "Fiscal Year",
        IF ( MONTH ( [Date] ) >= 7, YEAR ( [Date] ) + 1, YEAR ( [Date] ) ),
    "Fiscal Quarter",
        "Q"
            & MOD ( QUARTER ( [Date] ) + 2, 4 ) + 1,
    "Day of Year", DATEDIFF ( DATE ( YEAR ( [Date] ), 1, 1 ), [Date], DAY ) + 1
)

Create a one-to-many single direction relationship from that to the fact table and mark it as date table

danextian_1-1734952068515.png

 

Disable Auto date/time

danextian_0-1734952010297.png

 

Create a measure similar to below:

Sales Previous  Month = 
CALCULATE( [Sales], PREVIOUSMONTH ( 'Date'[Date] ) )

 

Refer to the attached pbix for the details.

 

Otherwise, please post a workable sample data (not ang image) and your expected result from that.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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