cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Anonymous
Not applicable

## need a measure

Hi,

I needed two measures to know current year ranking and previous year ranking from the data below:

 Country Name Ranking Year India 12 2019 India 10 2020 US 2 2020 US 1 2019

Thanks

1 ACCEPTED SOLUTION
Super User
CurrentYearRank = CALCULATE(sum(Countries[Ranking]), FILTER(Countries, Countries[Year] = year(today())))
PreviousYearRank = CALCULATE(sum(Countries[Ranking]), FILTER(Countries, Countries[Year] = year(today())-1))

This should work.

If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!

2 REPLIES 2
Super User
CurrentYearRank = CALCULATE(sum(Countries[Ranking]), FILTER(Countries, Countries[Year] = year(today())))
PreviousYearRank = CALCULATE(sum(Countries[Ranking]), FILTER(Countries, Countries[Year] = year(today())-1))

This should work.

If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!

Community Champion

Hi @Anonymous

try

``CurrentYear = CALCULATE(MAX(Table[Ranking]), Table[Year] = YEAR(TODAY()) )``

and

``PrevYear = CALCULATE(MAX(Table[Ranking]), Table[Year] = YEAR(TODAY())-1 )``

do not hesitate to give a kudo to useful posts and mark solutions as solution