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

How to calculate average of unique ID's for last six months?

Hi Guys,

 

I am learning in Power BI, Would appreciate your help on below query, I have a tabe like this and I have to find average of these ID's(i.e average of count of ID's)  for last 6 months,

 

Thank you!

 

IDDATE
11/10/2021
21/11/2021
32/11/2021
43/11/2021
54/11/2021
61/12/2021
72/12/2021
81/01/2022
92/01/2022
103/02/2022
114/03/2022
125/03/2022
1311/04/2022
1412/04/2022
1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try measure like

 

Rolling 6 Sales =
var _max = maxx(allselcted(date),date[date]) // or today()
var _min = date(year(_max), month(_max)-6,1)
return
CALCULATE(distinctcount(Table[ID]),filter(date, date[date] <=_max && date[date] >=_min))

 

or

 

Rolling 6 = CALCULATE(distinctcount(Table[ID]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-6,MONTH))

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
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.