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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculating Status count a at point in time

Hi folks,

Looking for help with DAX measure.

I have a requirment to get count of claims in pending status at a given point in time selected by the user. Below is the dataset, if user selects 30 the March 2024 from the date filter, I need to show how many claims were at pending status at that point in time. The table has the staus change date for the claim. As of 31st March there is 1 pending claim and as of 31st April there is 2 pending claim. need help with DAX to calculate this measure.

 

Claim NoStatus DateStatus
1234/12/23Pending
1234/02/24Closed
1234/03/24Pending
1234/04/24Open
12330/11/24Closed
1244/12/23Pending
1244/02/24Closed
12414/04/24Pending
12415/05/24Open
12420/11/24Closed
12515/04/24Pending
1251/06/24Open
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi ,

Based on the description, the method rajendraongole1 provided should be helpful. 

Besides, you can also create a new calendar table.

vjiewumsft_0-1733369969052.png

Then, drag the calendar table column to the slicer visual. Try using the following DAX formula to calculate the status count.

 

Measure = 
VAR SelectedDate = MAX('Table'[Date])
RETURN
    CALCULATE(
        COUNTROWS('Claim'),
        FILTER(
            'Claim',
            'Claim'[Status Date] <= SelectedDate &&
            'Claim'[Status] = "Pending" )
    )

 

The result is shown below.

vjiewumsft_1-1733370039048.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi ,

Based on the description, the method rajendraongole1 provided should be helpful. 

Besides, you can also create a new calendar table.

vjiewumsft_0-1733369969052.png

Then, drag the calendar table column to the slicer visual. Try using the following DAX formula to calculate the status count.

 

Measure = 
VAR SelectedDate = MAX('Table'[Date])
RETURN
    CALCULATE(
        COUNTROWS('Claim'),
        FILTER(
            'Claim',
            'Claim'[Status Date] <= SelectedDate &&
            'Claim'[Status] = "Pending" )
    )

 

The result is shown below.

vjiewumsft_1-1733370039048.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

divyed
Super User
Super User

Hello @Anonymous ,

 

Considering you have a date table with proper relation setup, you can try below dax

 

PendingStatusCount =
VAR SelectedDate = MAX('Date'[Date]) -- Get the selected date from the slicer. ALso can try SelectedValue('Date'[Date])
RETURN
CALCULATE(
COUNTROWS(Claims),
Claims[Status] = "Pending",
Claims[Status_Date] <= SelectedDate, -- Filter for claims where the status date is on or before the selected date
ISBLANK(CALCULATE(MAX(Claims[Status_Date]), Claims[Claim_Number] = EARLIER(Claims[Claim_Number]))) -- Ensure the latest status is pending for the given claim
)

 

I hope this helps.

 

Did I answer your query ? Mark this as solution if this helps, Kudos are appreciated.

 

Cheers

 

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/
johnt75
Super User
Super User

You can write a measure like

Num Pending at date = 
VAR FilteredTable = CALCULATETABLE(
	'Table',
	'Date'[Date] < MAX( 'Date'[Date] )
)
VAR PartitionedTable = CALCULATETABLE( 
	INDEX( 1, 
		FilteredTable,
		ORDERBY( 'Table'[Status Date], DESC ),
		PARTITIONBY( 'Table'[Claim No] ),
		MATCHBY( 'Table'[Claim No], 'Table'[Status Date] )
	),
	REMOVEFILTERS('Date')
)
VAR Result = COUNTROWS( FILTER( PartitionedTable, 'Table'[Status] = "Pending" ) )
RETURN Result
rajendraongole1
Super User
Super User

Hi @Anonymous - you can create below dax measure:

 

PendingClaimsCount =
VAR SelectedDate = SELECTEDVALUE('Calendar'[Date])
VAR ClaimsWithPendingStatus =
FILTER(
'Claims',
'Claims'[Status Date] <= SelectedDate &&
'Claims'[Status] = "Pending" &&
NOT (
CALCULATE(
MAX('Claims'[Status Date]),
ALLEXCEPT('Claims', 'Claims'[Claim No]),
'Claims'[Status Date] > 'Claims'[Status Date] &&
'Claims'[Status Date] <= SelectedDate
) > 'Claims'[Status Date]
)
)
RETURN
COUNTROWS(ClaimsWithPendingStatus)

 

 

replace with your model table name and details. Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.