Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a table 'Sales' with 3 main columns: ProductID, Date, Sales
I want to create a measure to count products with 3 consecutive months of growth.
This measure below is correct?
ProductsWith ThreeMonthsGrowth =
VAR __MonthlySales =
CALCULATE (
SUM ( Sales[SalesAmount] ),
DATESINPERIOD ( Sales[Date], MAX ( Sales[Date] ), -1, MONTH )
)
VAR __PrevMonthSales =
CALCULATE ( __MonthlySales, PREVIOUSMONTH ( Sales[Date] ) )
VAR __MonthlyGrowth =
IF (
NOT ( ISBLANK ( __PrevMonthSales ) )
&& __MonthlySales > __PrevMonthSales,
1,
0
)
VAR __ThreeMonthsGrowth =
CALCULATE (
COUNTROWS ( FILTER ( Sales, __MonthlyGrowth = 1 ) ),
DATESINPERIOD ( Sales[Date], MAX ( Sales[Date] ), -3, MONTH )
)
RETURN
CALCULATE (
DISTINCTCOUNT ( Sales[ProductID] ),
FILTER ( VALUES ( Sales[ProductID] ), __ThreeMonthsGrowth = 3 )
)
Solved! Go to Solution.
hi @Anna_48
Rolling 3 Months:=CALCULATE(count[Total_Qty],DATESINPERIOD('Qty'[Month],LASTDATE(Qty[Month]),-3,MONTH))
and you can refer below blog for understanding:
https://community.fabric.microsoft.com/t5/Desktop/Monthly-Rolling-Year-Count/m-p/3643683#M1192662
https://community.fabric.microsoft.com/t5/Desktop/Cumulative-Total-of-a-Measure-for-last-3-months/m-...
https://community.fabric.microsoft.com/t5/Desktop/Cumulative-Count-by-Date/m-p/368918#M167100
https://community.fabric.microsoft.com/t5/Desktop/Rolling-Counts/m-p/2100913#M779672
you can modify the measure according your start date and end date.
I hope I answered your question!
hi @Anna_48
Rolling 3 Months:=CALCULATE(count[Total_Qty],DATESINPERIOD('Qty'[Month],LASTDATE(Qty[Month]),-3,MONTH))
and you can refer below blog for understanding:
https://community.fabric.microsoft.com/t5/Desktop/Monthly-Rolling-Year-Count/m-p/3643683#M1192662
https://community.fabric.microsoft.com/t5/Desktop/Cumulative-Total-of-a-Measure-for-last-3-months/m-...
https://community.fabric.microsoft.com/t5/Desktop/Cumulative-Count-by-Date/m-p/368918#M167100
https://community.fabric.microsoft.com/t5/Desktop/Rolling-Counts/m-p/2100913#M779672
you can modify the measure according your start date and end date.
I hope I answered your question!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!