cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

month over month change to ignore current month in calculation.

I have created a quick measure in a qry  to calculate the month over month change in printed volume.  The problem I am having is that  the measuer is including the current month in the calculation eventhough there is no data fro the current month. 

 

This means that then current month is always negative and the final value is incorrect.   Is there away to get the measure to exclude the current month.  

 

Or is there away to filter a waterfall chart for the last that makes use of this sort of measure for only the previouse 12 months  If I try create a realitve date filter I get the following error

 

Error Message:
MdxScript(Model) (15, 2) Calculation error in measure 'qryDevicePerformanceReport'[Usage MoM%]: Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column.

 

 

Thanx in advance

1 REPLY 1
Super User II
Super User II

@Vexander, try the following measure:

 

MoM% = 
VAR vPrevMonth =
    CALCULATE ( SUM ( Volume[Amount] ), DATEADD ( 'Date'[Date], -1, MONTH ) )
VAR vCurMonth =
    SUM ( Volume[Amount] )
VAR vResult =
    DIVIDE ( vCurMonth - vPrevMonth, vPrevMonth )
RETURN
    IF ( ISBLANK ( vCurMonth ), BLANK (), vResult )

 

In this example, there is no data for August (current month), so there is no row for August in the table visual:

 

DataInsights_0-1598561894152.png

 

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors