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 the following measure for which counts the number of appointments for a given day:
CALCULATE(COUNT(Appointment[Date appointment]),
FILTER(Appointment, Appointment[Status] = "Planned" || Appointment[Status] = "Occurred"))
This produces the following table when combined with a Calendar[Date] column:
I want another column which shows the sum of appointments for the coming 6 months, for example, the 4-1-2021, which would sum the values from 4-1-2021 til 3-7-2021. However, the Appointment[Booking date] should not be larger than in this case 4-1-2021.
Does anyone know how to achieve this?
@Anonymous , Assume active join of date table is with Appoint date
Rolling 6 = CALCULATE(Calculate(Countrows(Table), filter(Table, Table[Booking Date] <=Max('Date'[Date]))) ,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),6,MONTH))
This unfortunately does not seem to provide the desired result:
Hi @Anonymous ,
Please try:
TEST =
CALCULATE (
COUNT ( Appointment[Date appointment] ),
FILTER (
Appointment,
Appointment[Status] = "Planned"
|| Appointment[Status] = "Occurred"
)
)Rolling 6 =
CALCULATE (
CALCULATE (
[TEST],
FILTER ( 'Calendar', 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
),
DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), 6, MONTH )
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Thank you for your respone @Anonymous!
The Appointment[Booking date] should not be larger than the date that is displayed in the 'Date' column as shown below. Right now, this constraint is not in place, hence why the values in 'Rolling 6.2' are too large. Do you have any idea how to achieve this?
Hi @Anonymous ,
Please try:
Rolling 6 =
CALCULATE (
CALCULATE (
[TEST],
FILTER ( 'Appointment', 'Appointment'[Booking date] <= MAX ( 'Calendar'[Date] ) )
),
DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), 6, MONTH )
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
@Anonymous I get the same result with this measure. The value for January 4th, for example, should be '942'. The booking date should not be larger than the 'row date' that is displayed in the table (which comes from Calendar[Date]). Any ideas?
Hi @Anonymous ,
I would first consider the relationship, can 'Appointment'[Booking date] be filtered by 'Calendar'[Date]?
Would you mind providing some sample files that do not contain sensitive data? It would be helpful to find out why, thanks in advance!
How to provide sample data in the Power BI Forum
Best Regards,
Gao
Community Support Team
Hi @Anonymous ,
The formula output is correct. Does your expected output need to consider de-duplicating the count of the results? This may be the reason for the larger result. Please check this file. The latter output is the result of considering the de-duplication.
If I misunderstood your needs, you could pick a date and demonstrate the calculation process and output based on this file, thanks in advance!
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Dear @Anonymous Thank you for your help! In the same PBI file, I have added a page (page 2) with manual filters which provides an example of the result I am looking for. I have also added some comments to try and clarify things further. Does this maybe clarify things? PBI file
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!
| User | Count |
|---|---|
| 104 | |
| 81 | |
| 66 | |
| 50 | |
| 45 |