This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi,
I want to count the open claims from the below table. Any claims not closed will carry to the next month as open.
i used the below measure but not giving accurate data.
| Claims ID | Created | Closed |
| 1909260948 | 28/09/2022 | 17/05/2023 |
| 1909271500 | 17/10/2022 | 28/03/2023 |
| 1909281045 | 27/10/2022 | 28/03/2023 |
| 1909291339 | 03/11/2022 | 28/03/2023 |
| 1909081108 | 13/12/2022 | 03/02/2023 |
| 1909081323 | 21/12/2022 | 17/02/2023 |
| 1909081123 | 22/02/2023 | 30/05/2023 |
| 1908101218 | 30/03/2023 | 03/04/2023 |
| 1908110817 | 14/04/2023 | 19/05/2023 |
| 1908110852 | 15/05/2023 | 19/05/2023 |
| 1908121007 | 15/05/2023 | 12/07/2023 |
| 1908171021 | 05/06/2023 | 15/06/2023 |
| 1917081223 | 05/06/2023 | 15/06/2023 |
| 1908171811 | 06/06/2023 | 15/06/2023 |
| 1909231812 | 12/06/2023 | 15/06/2023 |
| 1909281639 | 12/06/2023 | 28/06/2023 |
| 1909261146 | 16/08/2023 |
if you do a manual calculations it will be like below but measure gives different. Thanks in advance.
| Month Year | manual | measure |
| Jan-23 | 6 | 6 |
| Feb-23 | 7 | 4 |
| Mar-23 | 6 | 2 |
| Apr-23 | 4 | 2 |
| May-23 | 5 | 1 |
| Jun-23 | 6 | 1 |
| Jul-23 | 1 | no value |
| Aug-23 | 1 | no value |
Solved! Go to Solution.
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
1) create calendar table
Calendar = VAR BaseCalendar =
CALENDAR ( DATE ( 2022, 1, 1 ), DATE (2023, 12, 31 ))
RETURN
GENERATE (
BaseCalendar,
VAR BaseDate = [Date]
VAR YearDate = YEAR ( BaseDate )
VAR MonthNumber = MONTH ( BaseDate )
VAR YearMonthNumber = YearDate * 12 + MonthNumber - 1
RETURN ROW (
"Year", YearDate,
"Month Number", MonthNumber,
"Month", FORMAT ( BaseDate, "mmmm"),
"Year Month Number", YearMonthNumber,
"Year Month", FORMAT ( BaseDate, "mmm yy")
)
)
2) measure
count the open claims =
VAR _GenaretDateBetWeen =
GENERATE (
'Claims',
DATESBETWEEN (
'Calendar'[Date],
'Claims'[Created],
IF ( ISBLANK ( 'Claims'[Closed] ), 'Claims'[Created], 'Claims'[Closed] )
))
VAR _SelectColumns_And_Distinct =
DISTINCT(SELECTCOLUMNS(_GenaretDateBetWeen,
"Claims ID",[Claims ID] ,
"@Month_Year",FORMAT ([Date], "mmm yy")))
VAR _SelectOnlydateCoumns=
SELECTCOLUMNS(_SelectColumns_And_Distinct,"@Month_Year",[@Month_Year])
VAR _INTERSECT =
INTERSECT(_SelectOnlydateCoumns,VALUES('Calendar'[Year Month]))
RETURN
COUNTROWS(_INTERSECT)


1) create calendar table
Calendar = VAR BaseCalendar =
CALENDAR ( DATE ( 2022, 1, 1 ), DATE (2023, 12, 31 ))
RETURN
GENERATE (
BaseCalendar,
VAR BaseDate = [Date]
VAR YearDate = YEAR ( BaseDate )
VAR MonthNumber = MONTH ( BaseDate )
VAR YearMonthNumber = YearDate * 12 + MonthNumber - 1
RETURN ROW (
"Year", YearDate,
"Month Number", MonthNumber,
"Month", FORMAT ( BaseDate, "mmmm"),
"Year Month Number", YearMonthNumber,
"Year Month", FORMAT ( BaseDate, "mmm yy")
)
)
2) measure
count the open claims =
VAR _GenaretDateBetWeen =
GENERATE (
'Claims',
DATESBETWEEN (
'Calendar'[Date],
'Claims'[Created],
IF ( ISBLANK ( 'Claims'[Closed] ), 'Claims'[Created], 'Claims'[Closed] )
))
VAR _SelectColumns_And_Distinct =
DISTINCT(SELECTCOLUMNS(_GenaretDateBetWeen,
"Claims ID",[Claims ID] ,
"@Month_Year",FORMAT ([Date], "mmm yy")))
VAR _SelectOnlydateCoumns=
SELECTCOLUMNS(_SelectColumns_And_Distinct,"@Month_Year",[@Month_Year])
VAR _INTERSECT =
INTERSECT(_SelectOnlydateCoumns,VALUES('Calendar'[Year Month]))
RETURN
COUNTROWS(_INTERSECT)

Thanks Ahmedx, appriciated.👍
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Hi Ahmedx,
thanks but i can't open this with my version of power bi.
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 26 | |
| 25 | |
| 22 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 42 | |
| 41 | |
| 40 | |
| 21 | |
| 20 |