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

A 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.

Reply
Anonymous
Not applicable

Counting item data based on former status

Dear community, 

 

I have 2 tables, a "Fiscal Year" date table and a table with items that change their status over time (see below) e.g. 

Status open when there is a " date created" and Status closed when there is a "Closed date".

I need to be able to count the number of items that were "open" based on the date I filter:

Example below:

If I filter on October 8th 2022 it should count:

All items that have a "Date Created" => 10.08.22 with no "Closed Date" (the ones with the status Open)

+

all with a "closed Date" > 10.08.22 && "Date Created" <= 10.08.22 (The ones with the status filled but had the status "open" on the date of filter)

 

Svendu_0-1669729270668.png

 

Somehow I have not been lucky with several solutions from slightly similar issues in the community. 

 

Thank you very much in advance for any clue!!

Svendu 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Measure = 
VAR _N1 =CALCULATE (COUNT ( 'Table'[ID Number] ),
          FILTER (ALL ( 'Table' ),
            [Date Created] >= SELECTEDVALUE ( 'Date'[Date] )
                && [Closed Date] = BLANK ()
                && [Status] = "Open"
        )
    )
VAR _N2 =CALCULATE (COUNT ( 'Table'[ID Number] ),
        FILTER (ALL ( 'Table' ),
            [Date Created] <= SELECTEDVALUE ( 'Date'[Date] )
                && [Closed Date] >= SELECTEDVALUE ( 'Date'[Date] )
                && [Status] = "Filled"
        )
    )
RETURN
    _N1 + _N2

vzhangti_0-1669792630296.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
Anonymous
Not applicable

Thank you very much for your prompt and helpful reply on this issue. 

Svendu

v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Measure = 
VAR _N1 =CALCULATE (COUNT ( 'Table'[ID Number] ),
          FILTER (ALL ( 'Table' ),
            [Date Created] >= SELECTEDVALUE ( 'Date'[Date] )
                && [Closed Date] = BLANK ()
                && [Status] = "Open"
        )
    )
VAR _N2 =CALCULATE (COUNT ( 'Table'[ID Number] ),
        FILTER (ALL ( 'Table' ),
            [Date Created] <= SELECTEDVALUE ( 'Date'[Date] )
                && [Closed Date] >= SELECTEDVALUE ( 'Date'[Date] )
                && [Status] = "Filled"
        )
    )
RETURN
    _N1 + _N2

vzhangti_0-1669792630296.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.