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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.