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
nprasanthk
Frequent Visitor

Need n, n-1, n-2, n-3, n-4, n-5 months data

Hi All,

I am struggling to achive the below requirment.

requirment is:

we have two dates 1. Forecast dates 2. forecast months.

each forecast dates have 12 forecast months. currently i have only 5 forecast dates. (01-Aug-22, 10-Sept-22, 20-Oct-22, 25-Nov-22, 30-Dec-22)

nprasanthk_0-1683695818247.png

if user select the 23-Feb forcast month then that Feb month is current month this is (n)

then 23-Jan Month Feb becomes (n-1)

then 22-Dec month Feb becomes (n-2)

then 22-Nov Month Feb becomes (n-3)

then 22-Oct Month Feb becomes (n-4)

 

like if user selec 22-Dec then it becomes n then rest all n-1, n-2, n-3, n-4.

so it should be dynamic.

my measure is SUM(Quantity)

 

Thanks in Advance.

1 REPLY 1
amitchandak
Super User
Super User

@nprasanthk , with help from date table( if needed create date from month year) joined with date of your table

 

last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

last 2nd MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-2,MONTH)))
last 2nd month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth(dateadd('Date'[Date],-1,MONTH)))

 

last 3rd MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-3,MONTH)))
last 3rd month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth(dateadd('Date'[Date],-2,MONTH)))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

If you need a trend (of 6 months when 1 is selected) then you consider the independent table

 

Need of an Independent Table in Power BI - Exclude: https://youtu.be/lOEW-YUrAbE

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

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.