Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi
I have created a measure to sum sales over past 12 months, before August 2017
I want the measure to calculate the previous 12 month sales from a date that is selected in a slicer (Dates Table0
Measure = CALCULATE(sum(EOM_STK[Sales]), 'EOM_STK'[perioddate]<=DATE(2017, 08, 1) && 'EOM_STK'[perioddate]>=DATE(2016, 09, 1))
Dates table
Year Month FilterDate
2017 01 2017-01-01
2017 02 2017-02-01
etc
if I substitue the dates for the date slicer, I get the error message that the expression contains multiple columns but only a single column can be used in a true/false expression. What am I doing wrong?
You may add FILTER Function to the formula.
https://www.sqlbi.com/articles/filter-arguments-in-calculate/
Hi,
Apologies for the delay in responding. Filter was the solution, just wasnt sure how to use it.
This was my solution for the sales over 12 months, I had a slicer to select the end period
var curDateStr = CALCULATE ( MIN ( Dates2[FilterDate] ), ALLEXCEPT ( Dates2, Dates2[FilterDate] ) )
var curDate = DATE(LEFT(curDateStr,4),VALUE(MID(curDateStr,6,2)),RIGHT(curDateStr,1))
VAR DateAddAlternative = EDATE(curDate,-MonthsToLookBack)
return
CALCULATE ( SUM ( 'EOM_STK'[SOH] ), FILTER(EOM_STK,
EOM_STK[perioddate]=curDate
))
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |