Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
freginier
Impactful Individual
Impactful Individual

Get Previous year from selected year

Hello, 

 

Need help please ! 

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

 

freginier_0-1634931349552.png

 

 

2 ACCEPTED SOLUTIONS

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

Any solution with a connected Date ? 

View solution in original post

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:

vrobertqmsft_0-1635759757124.png

 

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.

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@freginier Try:

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


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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

Any solution with a connected Date ? 

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:

vrobertqmsft_0-1635759757124.png

 

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.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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