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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi there,
I need some help with this dax measure formula please
I have the data set table on the left hand side - showing continuous periods of time flagged by an instance_id
I need the DAX to calculate the field i've highlighed in yellow - which is basically a unique count of the instance ID on a rolling 5 DAY basis.
e.g. - the value of 3 found on date 16/01/2020 is found by looking up the unique ids in the data set between 12/01/2020 and 16/01/2020 (5 day period) - and finding that there are three unique ids (3, 4 and 5) - there are two 4s, but it ignores one due to unique count
Is someone able to help with this?
Many thanks
Solved! Go to Solution.
unique instance count 5 days rolling total : =
CALCULATE (
DISTINCTCOUNTNOBLANK ( Data[instance_id] ),
DATESINPERIOD ( 'Calendar'[Date], LASTDATE ( 'Calendar'[Date] ), -5, DAY )
)
thanks @Jihwan_Kim - i've accepted this as a solution for this question.
However, I am still having issues as I am not able to use a measure to complete this calculation - i need to use a calculated column and I also am not able to use a separate date column as you have outlined in your solution.
I've created another post with a different version of the question - if you are able to take a look:
unique instance count 5 days rolling total : =
CALCULATE (
DISTINCTCOUNTNOBLANK ( Data[instance_id] ),
DATESINPERIOD ( 'Calendar'[Date], LASTDATE ( 'Calendar'[Date] ), -5, DAY )
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 19 | |
| 11 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 20 | |
| 12 | |
| 10 |