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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
jppuam
Helper V
Helper V

calculating specific months

Hello,

i need to calculate the values from the current month in a metric, and also need to have to sum values of the previous 6 months.

having the filter, im doing the following below to calculated the valur from June.

When i need to calculate the last 6M, i need to have the values greater than 30 November 23 until May 24. But its not adding the values from 2023, even if i use ALL in the filter. can you understand why ?

thanks,

JR

z1.jpg

1 ACCEPTED SOLUTION

Hi @jppuam ,

 

My workaround changes dynamically based on the top value of the slicer, you can try it.

 

Best Regards,

Stephen Tao

 

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

7 REPLIES 7
jppuam
Helper V
Helper V

Hello,

thanks for the response. I've tested with ALL, and it still doesnt work.

I dont understand why....If i delete the data filter, the metrics work. or if i've put the biggining of the filter at the end of 2023, it works.....

but for me it should work as im saying...

JR

Hi @jppuam ,

 

I think you should modify your measure as 

 

Measure = 
var _date=CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table'))
var _end=EOMONTH(_date,-1)
var _start=EOMONTH(_date,-7)
return
CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Date]>_start&&[Date]<=_end))

 

Sample data:

vstephenmsft_1-1721895854557.png

The measure should return the sum of the below even the slicer existing.

vstephenmsft_3-1721896067984.png

vstephenmsft_2-1721895912048.png

 

Best Regards,

Stephen Tao

 

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

 

 

Thansk Stephen,

i think it works.

but just one thing that it is not ok, because i want to make the calculations basead on the top Month, the values that you have on the others month shouldn't be equal.

for example, for this example, you are looking for the that from Dez23 - May24

but the value for May24, should be the calculations between Nov23 and Apr24,

and so one.

JR

Hi @jppuam ,

 

My workaround changes dynamically based on the top value of the slicer, you can try it.

 

Best Regards,

Stephen Tao

 

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

 

 

its not working when im adapting, but in your example its working. i'll try to see whats wrong.

Thanks Stephen 🙂

MFelix
Super User
Super User

Hi @jppuam ,

 

Since you are using the ALLSELECTED the calculation is getting only the filtered values for this you need to use the ALL statement to get the full information and then apply the filter to the selected time frame.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hello Miguel,

i've tested with ALL, and its not working.

thansk for the respose.

JR

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors