Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi, I have two col. Date and ID. I want for each date (day) make a distinct count for ID. R12. Twelve months back and rolling.
Plz help!
Ex. data.
| Date | ID | Create_measure (count(distinct ID last 12 month (R12) for each date) |
| 2021-08-24 | 101 | 8 |
| 2021-08-24 | 102 | 8 |
| 2021-08-24 | 103 | 8 |
| 2021-08-24 | 101 | 8 |
| 2021-08-25 | 201 | 8 |
| 2021-08-25 | 201 | 8 |
| 2021-08-25 | 202 | 8 |
| 2021-08-25 | 101 | 8 |
| 2021-09-05 | 101 | 8 |
| 2021-09-05 | 102 | 8 |
| 2021-09-05 | 106 | 8 |
| 2021-09-05 | 107 | 8 |
| 2021-09-05 | 108 | 8 |
| … | … |
Hi, Can someone plz help me find a solution @v-kelly-msft ? The file is uploaded. Thx! 🙂
Hi @Anonymous ,
First create a related date table and create a relationship between the 2 tables;
Then create a measure as below:
Measure =
CALCULATE (
DISTINCTCOUNT ( 'Table'[ID] ),
FILTER (
ALL ( 'Table' ),
'Table'[Date] <= MAX ( 'date table'[Date] )
&& 'Table'[Date] >= DATEADD ( 'date table'[Date], -12, MONTH )
)
)
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!
Some screendump
Hi! Sorry.. i can't get it to work as i want. I have my pbix-file but i cant attach it to the meassage. Plz help
Hi @Anonymous ,
Pls upload it to a cloud service then share a public link with us.
Remember to remove the confidential information.
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!
@Anonymous , You have to create measures like these examples
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))
or
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-12,MONTH))
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |