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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Previous Month calculation (only include months from current year where we have data)

Hi all, 

 

I'm having a bit of a trouble with creating some measures correctly. 

I want to have a bar-chart visualization of change in percentage for current month vs. previous month. 

 

In the data I've created some sample data which has values in the months between january 2019 to november 2019 (no data for december 2019). However, the previous month measure calculates the november 2019 value and uses this so that in the bar chart I get a -100% change since previous month for december 2019. 

 

Anyone know a way to sort this, so that I only calculate previous months where I have data for current month? 

 

Here is some screenshots of current state: 

 

Sample table.JPGsample barchart.JPG

The measures I got at the moment is: 

Total Value = SUM ( FACT_Test[SampleData] )
Previous Month = CALCULATE ( [Total Value] ; PREVIOUSMONTH (DIM_Date[Date] ))

% Change = DIVIDE ( [Total Value] ; [Previous Month] ; BLANK() ) -1

 

Thanks 🙂 

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

I edited your measures with adding IF function, please kindly check whether it works for you:

Previous Month = IF(ISBLANK([Total MonthlyMockUp]),BLANK(),CALCULATE( [Total MonthlyMockUp] , PREVIOUSMONTH( 'Date'[Date] )))

 

% change = IF(ISBLANK([Previous Month]),BLANK(),DIVIDE( [Total MonthlyMockUp] , [Previous Month] , BLANK() ) - 1)

0007.PNG 

Pbix attached,

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

View solution in original post

4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

You might consider creating pbix file that will contain some sample data, upload the pbix to onedrive or dropbox and share the link to the file. Please do not forget to describe the expected results based on this sample data.

I'd like to draw it up for you.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

Hi @v-diye-msft

 

Thanks for your reply. 

 

Here is the link for the .pbix: 

https://1drv.ms/u/s!AnO2QNNGszZMjWorRLvE2Zqriy4y?e=oA6AFb

 

Hi @Anonymous 

 

I edited your measures with adding IF function, please kindly check whether it works for you:

Previous Month = IF(ISBLANK([Total MonthlyMockUp]),BLANK(),CALCULATE( [Total MonthlyMockUp] , PREVIOUSMONTH( 'Date'[Date] )))

 

% change = IF(ISBLANK([Previous Month]),BLANK(),DIVIDE( [Total MonthlyMockUp] , [Previous Month] , BLANK() ) - 1)

0007.PNG 

Pbix attached,

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

Thank you @v-diye-msft 

 

This works 🙂 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.