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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
ArielCz91
Frequent Visitor

Sales value of lost contractors

I need a measure that will sum up the sales value of contractors for 12 months who have not made purchases in the last 12 months. This value is supposed to be the sum of purchases from the 13th to the 24th month back. The measure of sales is SprWdPH

 

Thank for help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @ArielCz91 ,

I created some data:

Sorry, not quite sure what you mean, do you want to add up the amounts for the next 12 months for those who have not made purchases in the last 12 months?

vyangliumsft_0-1698738748304.png

 

Here are the steps you can follow:

1. Create measure.

 

Flag =
var _today=TODAY()
var _last12=DATE(YEAR(_today)-1,MONTH(_today),DAY(_today))
var _Next12=DATE(YEAR(_today)+1,MONTH(_today),DAY(_today))
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[contractors]=MAX('Table'[contractors])&&'Table'[Date]>=_last12&&'Table'[Date]<=_today),"pur",[purchases])
return
IF(
    "No" in _column&&MAX('Table'[Date])>_today&&MAX('Table'[Date])<=_Next12,1,0)
Measure =
SUMX(
    ALLSELECTED('Table'),[SprWdPH])

 

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1698738748304.png

3. Result:

vyangliumsft_2-1698738794403.png

If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

2 REPLIES 2
Anonymous
Not applicable

Hi  @ArielCz91 ,

I created some data:

Sorry, not quite sure what you mean, do you want to add up the amounts for the next 12 months for those who have not made purchases in the last 12 months?

vyangliumsft_0-1698738748304.png

 

Here are the steps you can follow:

1. Create measure.

 

Flag =
var _today=TODAY()
var _last12=DATE(YEAR(_today)-1,MONTH(_today),DAY(_today))
var _Next12=DATE(YEAR(_today)+1,MONTH(_today),DAY(_today))
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[contractors]=MAX('Table'[contractors])&&'Table'[Date]>=_last12&&'Table'[Date]<=_today),"pur",[purchases])
return
IF(
    "No" in _column&&MAX('Table'[Date])>_today&&MAX('Table'[Date])<=_Next12,1,0)
Measure =
SUMX(
    ALLSELECTED('Table'),[SprWdPH])

 

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1698738748304.png

3. Result:

vyangliumsft_2-1698738794403.png

If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

FreemanZ
Community Champion
Community Champion

hi @ArielCz91 ,

 

try to add some sample data and you will get a solution quicker. 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.

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.

Top Solution Authors