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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Display Values only for the last year if no filter is selected - DAX

Hello everyone,

I have a question that I think is simple but I'm not getting it.

 

I wanted to see values only in the last year, if no filter is selected:

 

YEAR: (all)

 

Month Value

Jan 20

  
Feb 20  
Mar 20  
(....)  

Dec 20

  
Jan 21 123
Feb 21 3232
Mar 21 32323


Thank you very much in advance for your help,
Simão

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Assume you have a year column too

 


measure =
var _1 = year(today())-1
return
if(isfiltered(Table[Year]) , calculate(sum(Table[Value])),calculate(sum(Table[Value]), filter(Table, Table[year] =_1)))

 

or

 


measure =
var _1 = year(today())-1
return
if(isfiltered(Table[Month]) , calculate(sum(Table[Value])),calculate(sum(Table[Value]), filter(Table, Table[year] =_1)))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Assume you have a year column too

 


measure =
var _1 = year(today())-1
return
if(isfiltered(Table[Year]) , calculate(sum(Table[Value])),calculate(sum(Table[Value]), filter(Table, Table[year] =_1)))

 

or

 


measure =
var _1 = year(today())-1
return
if(isfiltered(Table[Month]) , calculate(sum(Table[Value])),calculate(sum(Table[Value]), filter(Table, Table[year] =_1)))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you very much!

This is just what I was looking for!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors