cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Solution Specialist

## Get Previous year from selected year

Hello,

I need to get value of previous year depend year select with a slicer.

When I select 2021 I want to see value for 2020. how can I do that ?

I try to use SELECTEDVALUE : CALCULATE(sum(value), YEAR(date)=SELECTEDVALUE(Col1)-1)...

Thank You

2 ACCEPTED SOLUTIONS
Solution Specialist

Thank you ! that work with a Date not connected (I create a Date Table not connected).

Any solution with a connected Date ?

Community Support

Hi, @freginier

As far as I’m concerned, you can just use one single table without a calendar table connected to achieve your requirement, you can create a measure like this:

``Sum = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[Year]=SELECTEDVALUE('Table'[Year])-1))``

Then you can create a card chart to place the measure like this:

And you can get what you want.

Thank you very much!

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 REPLIES 3
Super User

@freginier Try:

``CALCULATE(sum(value), ALL('Table'), YEAR(date)=SELECTEDVALUE(Col1)-1)``

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Solution Specialist

Thank you ! that work with a Date not connected (I create a Date Table not connected).

Any solution with a connected Date ?

Community Support

Hi, @freginier

As far as I’m concerned, you can just use one single table without a calendar table connected to achieve your requirement, you can create a measure like this:

``Sum = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),[Year]=SELECTEDVALUE('Table'[Year])-1))``

Then you can create a card chart to place the measure like this:

And you can get what you want.

Thank you very much!

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors