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.
Hi guys,
im testing a measure with current sales and i want to compare this year sales until today vs last year sales until today-1.
Attached the next:
1.
Solved! Go to Solution.
Hi, @JM_DAX
I briefly simulated some data that I hope fits your situation.
Measure:
this year sales until today =
CALCULATE (
[#sales],
FILTER ( ALL ( Calendario ), Calendario[Year] = 2022 && [Date] <= TODAY () )
)
last year sales until today-1 =
Var PreviousYearTotalSales = CALCULATE([#sales],FILTER(ALL(Calendario),[Year]=2021))
Var thisyearsalesuntiltoday =
CALCULATE (
[#sales],
FILTER ( ALL ( Calendario ), Calendario[Year] = 2022 && [Date] <TODAY ()-1 )
)
return
PreviousYearTotalSales+thisyearsalesuntiltoday
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @JM_DAX
I briefly simulated some data that I hope fits your situation.
Measure:
this year sales until today =
CALCULATE (
[#sales],
FILTER ( ALL ( Calendario ), Calendario[Year] = 2022 && [Date] <= TODAY () )
)
last year sales until today-1 =
Var PreviousYearTotalSales = CALCULATE([#sales],FILTER(ALL(Calendario),[Year]=2021))
Var thisyearsalesuntiltoday =
CALCULATE (
[#sales],
FILTER ( ALL ( Calendario ), Calendario[Year] = 2022 && [Date] <TODAY ()-1 )
)
return
PreviousYearTotalSales+thisyearsalesuntiltoday
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Previous YTD Sales = CALCULATE( [#sales],
SAMEPERIODLASTYEAR( DATESBETWEEN( 'Calendario'[Date], DATE(YEAR(TODAY()), 1, 1), TODAY() - 1) )
)
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 |
---|---|
14 | |
10 | |
10 | |
10 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |