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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

Date Filter of a Measure

I am hoping that someone can help me. I have written a measure to return the 12mma (12 month moving average) value which is in the images attached. The 12mma shows in two ways, on the card (circled in red) and on the graph as the light blue line.

 

The measure works correctly as it shows on the graph (light blue line) correctly. If I specifically select a month on my graph it also shows the correct value in the card. However, the problem I am having is the value in the card is not showing the correct value for the most recent month if I do not select a specific month on my graph. 

 

I have tried:

  • Relative date filter for last 1 calendar months (does not work and returns blank if I select any month other than the last month in the range)
  • Tried the Top N filter for the Top 1 by first month. This does not work at all. 
  • Various forms of measures but been unsuccessful. 

Is there a way to write a new measure to determine the most recent value of my existing measure if I have not selected a specific month? If I have selected a specific month then just return the measured value (how it already works).

 

Sorry if my explanation is confusing, happy to explain further if needed. I have attached images for reference. 

 

The first image shows when nothing is selected. The circled value in the card should be 4,744 (as shown in the second image when I selected March).

Measure.PNG

 

Measure When Selected.PNG

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Have you created a measure like

 

Rolling 12 = calculate(AverageX(Values('Date'[MONTH Year]),CALCULATE(sum(Sales[Sales Amount]))),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

Anonymous
Not applicable

@amitchandak  This is the original measure I have created. As you can see the original measure is not a simple measure. This measure returns the correct result if the month is selected. It also returns the correct result for the graph. The problem is when it is in the card. The card does not show the most recent month.

 

Life Measure 1.PNGLife Measure 2.PNG

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors