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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Gugge
Helper I
Helper I

3 Month Rolling creates "new" months

Hi, I'm new to PowerBI, I'm trying to do a three month rolling sales chart.

I've managed to get it to work, but not as I want it to.

 

First, I've created a DateTable using:

PBIDate = calendar(firstdate(SalesData[Posting_Date]),lastdate(SalesData[Posting_Date]))

This seems to work to always only show first and last date in my extracted data.

 

I have then for my three month rolling used the following formula (I've used both MAX and LASTDATE);

Measure = calculate(sum(SalesData[Sales_Amount_Actual]),

datesinperiod(PBIDate[Date],

MAX(PBIDate[Date]),-3,month))+0

 

The formula works fine for the period where I have data (Nov-18 until Jun-20). But for some reason, it also creates numbers for jan-18 until dec-20. How do I change this so it only calculates for the months that I have data.Capture.PNG

(Green line shows 3MR, Black is AVR 3MR, red is actual each month)

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Gugge , +0 forces complete left. So remove that. In Visual use type = continuous

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Gugge , +0 forces complete left. So remove that. In Visual use type = continuous

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you @amitchandak 

That's why, that solution works to remove the month before and after. But it ruins my line chart as all month within the period with no data ss not shown as zero.

 

I realized I can lock start date at the X-axis to begin when my data begins so atleast that issue is "solved". But it seems I need to choose between showing months with no data as zeros and have the future month included.

Or show the months without data as a line from last month with data to next month with data and show data until last month.

 

For me it makes more sense to have an empty month as zero, it seems more logic.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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