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 have aggregated the monthly sales from my salesorder table to a table containing the monthly sales information. What I'm trying to do is create a column that references the monthly sales from the previous year to show the monthly change.
This is a model of what I have so far:
Month | Year | ThisMonthSales |
January | 2018 | $1000 |
January | 2019 | $2000 |
January | 2020 | $3000 |
January | 2021 | $4000 |
February | 2019 | $1500 |
February | 2020 | $2500 |
This is what I'd like to create:
Month | Year | ThisMonthSales | LastYearMonthSales |
January | 2018 | $1000 | |
January | 2019 | $2000 | $1000 |
January | 2020 | $3000 | $2000 |
January | 2021 | $4000 | $3000 |
February | 2019 | $1500 | |
February | 2020 | $2500 | $1500 |
I tried this command, but the issue I'm running into is that the calculated column contains the yearly aggregated sales instead of the monthly sales:
Column =
VAR Last_Year = 'Table'[Year] - 1
RETURN
CALCULATE(SUM('Table'[This Month Sales]), ALL('Table'), 'Table'[Year] = Last_Year, 'Table'[Month] = 'Table'[Month])
What's the best way for me to accomplish this?
Solved! Go to Solution.
@gsmith_eqd
please try
Column =
VAR Last_Year = 'Table'[Year] - 1
RETURN
CALCULATE (
SUM ( 'Table'[This Month Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Month] ),
'Table'[Year] = Last_Year
)
@gsmith_eqd
please try
Column =
VAR Last_Year = 'Table'[Year] - 1
RETURN
CALCULATE (
SUM ( 'Table'[This Month Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Month] ),
'Table'[Year] = Last_Year
)
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 |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
9 |