Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have the following measure which I would like to use to show the data for the last year and the current year. How can I achieve this without hardcoding the years? Thanks in advance!
CALCULATE(SUM(Payments[Revenue]),
FILTER(Payments, Payments[Code] = 8505))
Solved! Go to Solution.
Hi, @Sohan ;
If you want to ask for last year and this year data, it's better to use 2 measures.
This year:
this year =
CALCULATE (
SUM ( Payments[Revenue] ),
FILTER (
ALL ( Payments ),
YEAR ( [date] ) = YEAR ( MAX ( [date] ) )
&& Payments[Code] = 8505
)
)
Last Year:
last year =
CALCULATE (
SUM ( Payments[Revenue] ),
FILTER (
ALL ( Payments ),
YEAR ( [date] )
= YEAR ( MAX ( [date] ) ) - 1
&& Payments[Code] = 8505
)
)
Or can you share a simple file and the result what you want output?
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Sohan ;
If you want to ask for last year and this year data, it's better to use 2 measures.
This year:
this year =
CALCULATE (
SUM ( Payments[Revenue] ),
FILTER (
ALL ( Payments ),
YEAR ( [date] ) = YEAR ( MAX ( [date] ) )
&& Payments[Code] = 8505
)
)
Last Year:
last year =
CALCULATE (
SUM ( Payments[Revenue] ),
FILTER (
ALL ( Payments ),
YEAR ( [date] )
= YEAR ( MAX ( [date] ) ) - 1
&& Payments[Code] = 8505
)
)
Or can you share a simple file and the result what you want output?
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For day on day sales from last year you can use SAMEPERIODLASTYEAR
CALCULATE([TotalSales],SAMEPERIODLASTYEAR(datesTable[Date]))
If you need particularly on yealry basis, then:
PreviousYearSales =
var currentyear = YEAR(TODAY())
var thisyearsales = CALCULATE([TotalSales],FILTER(DatesTable, DatesTable[Year] = currentyear))
For last year, just take lastyear = YEAR(TODAY())-1
User | Count |
---|---|
85 | |
79 | |
64 | |
52 | |
46 |
User | Count |
---|---|
101 | |
44 | |
41 | |
39 | |
37 |