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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
yaman123
Post Partisan
Post Partisan

Past 12 Months Transfers

Hi all,  

 

I have the below measure but it is not producing the correct result. 

 

Measure 2 =

var x1= SELECTEDVALUE('Date'[Date].[MonthNo])

var x2=MAXX('Table',('Table'[FROM DATE].[MonthNo]))


return

IF(x2>=x1-12&&x2<=x1,1,0)
 
I would like to show all data from the chosen date and the previous 12 months. The measure is only showing me the month for last year.
 
E.g if i select Feb 2021, i would like to show all data previous 12 months. But the measure is showing me Feb 21 and Feb 20 data only. 
 
TIA 
 
Yasir
1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @yaman123 

 

It’s wrong to get the month like 'x2>=x1-12&&x2<=x1'. If you have a month slicer, and you want to filter data in table viusal, you can put the following measure in filter pane and set 1.

measure =
IF (
    DATEDIFF ( MAX ( 'Table'[FROM DATE] ), SELECTEDVALUE ( 'Date'[Date] ), MONTH ) <= 12,
    1,
    0
)

If it doesn’t solve your problem, please share some sample data and your desired result ,and feel free to ask me.

 

Best Regards

Janey Guo

 

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

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

Hi, @yaman123 

 

It’s wrong to get the month like 'x2>=x1-12&&x2<=x1'. If you have a month slicer, and you want to filter data in table viusal, you can put the following measure in filter pane and set 1.

measure =
IF (
    DATEDIFF ( MAX ( 'Table'[FROM DATE] ), SELECTEDVALUE ( 'Date'[Date] ), MONTH ) <= 12,
    1,
    0
)

If it doesn’t solve your problem, please share some sample data and your desired result ,and feel free to ask me.

 

Best Regards

Janey Guo

 

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

Hi, 

 

Thanks for that. I think that gives me what i require 

 

 

amitchandak
Super User
Super User

@yaman123 , refer to my video on the same topic if that can help

https://www.youtube.com/watch?v=44fGGmg9fHI

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

Hi, 

 

That doesnt help. 

 

I would like to show the past 12 months of transfers

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.