Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
Solved! Go to Solution.
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?
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.
3. Result:
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
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?
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.
3. Result:
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
10 | |
10 | |
9 | |
7 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |