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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Determine Sales where customer join date < 12 months ago

Hi All,

 

I'd like to calculate roughly the following:

 

Calculate(SUM(Table[sales], 

Filter(Table, Table[NewClientDate] < 12 months ago. 

 

The goal is for this measure to show the number of sales by customers that joined in the past 12 months. It should be dynamic in the sense that if the date is January 2021, it should only include sales from customers that joined in January 2020 until then. 

 

Thanks in advance,

 

Justin

 

 

1 ACCEPTED SOLUTION

Hi,

For a more dynamic calcuation try this:

CALCULATE ( selectedmeasure(), DATESBETWEEN ( 'Calendar'[Date], DATEADD ( LASTDATE ( DATEADD ( 'Calendar'[Date], -12, MONTH ) ), +1, DAY ), LASTDATE ( 'Calendar'[Date] ) )  )




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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ValtteriN
Super User
Super User

Hi,

You can create this kind of logic by Calculating 12Months sales and then placing that in a IF condition. E.g. IF(AND([Sales 12M>0],[Sales ALL]=0),[Sales 12M],0)

So if there are sales within the last 12M and before that there isn't any Sales then display the Sales from last 12M.

For 12M calculations you can use this kind of pattern:

var selection_today = CALCULATE (
selectedmeasure(),
DATESBETWEEN (
'Calendar'[Date],
EDATE(TODAY(),-12)
,
today()
)
)


return
selection_today

This is a calculation group so you can replace SELECTEDMEASURE() with your [Sales].


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!








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

Proud to be a Super User!




Anonymous
Not applicable

Hi @ValtteriN 

 

It's close, but not exactly what I'm looking for. In the calculation you propose, it only shows data for 2021 in my tables, because it compares the date to Today. I'd actually like it to be compared to the current month + year that is selected in my date. Something like the table below.

 

Hope this clarifies it! Thanks in advance,

 

Justin

 

MonthSalesSales (customer join date <12 months ago)
Jan 2021  
Feb 2021  
etc  
Jan 2022  

Hi,

For a more dynamic calcuation try this:

CALCULATE ( selectedmeasure(), DATESBETWEEN ( 'Calendar'[Date], DATEADD ( LASTDATE ( DATEADD ( 'Calendar'[Date], -12, MONTH ) ), +1, DAY ), LASTDATE ( 'Calendar'[Date] ) )  )




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

Proud to be a Super User!




Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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