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
CROforce
Helper I
Helper I

Count by Date using filters

Here is my sample data table called “observation” :

Capture.PNG

 

I have also created new Table called “Calendar” in Query editor which contains Date that goes from 9/30/2015 until today and I also have Index column.

Capture 1.PNG

 

“observation” and “Calendar” are related by “Date Opened” and “Date Open”.

What I am trying to do is to have a column that would show me how many items where open based on Date opened from “observation” and Date Open from “Calendar” while filtering whatever user selects from “Gating Milestone” located under “observation”.

In other words, if user selects “PVT 1” filter, calculations should show total values based on that date… Something like this:

Capture2.PNG

If user selects multiple filters like PVT 1 and DVT 1, then total should be something like this: 

Capture3.PNG

 

So far I have this formula for open: 


Open = COUNTX( FILTER ( 'observation', 'observation'[Date Opened] = 'Calendar'[Date Open] ), 'observation'[Date Opened] )

 

And this one for closed:

Closed = 
    COUNTX (
        FILTER ( 'observation', 'observation'[Date Closed] = 'Calendar'[Date Open] ),
        'observation'[Date Closed]
    )

But those always show static number and do not incorporate filtering of “Gating Milestone” … Is there a way to add filter to incorporate filtering by user selection of “Gating Milestone”?

1 ACCEPTED SOLUTION
dkay84_PowerBI
Microsoft Employee
Microsoft Employee

Rather than custom formulas, have you tried the "Group By" funcitonality  within the query editor?

View solution in original post

4 REPLIES 4
dkay84_PowerBI
Microsoft Employee
Microsoft Employee

Rather than custom formulas, have you tried the "Group By" funcitonality  within the query editor?

That actually worked (the filtering part)... Thank you for the help. However, when I try to create Measure to calculate "Net Open" over time period to show on the Chart, it's not giving me right number based on filters selected:

 

Here is my table (gruped by) and I have also addedd Index to this to start from 1:

Capture.PNG

 

Then I have created Messure to count Net Open overtime using the same formula as in my previous attempt which worked (but I couldn't figureouit Gating Milestone filtering):

Now calculations here are not right as you can see numbers do not match:

Capture2.PNG

 

And if I select any filter from the Gating Milestone, the numbers would be totally wrong 😞

 

This is what the chart should look like (blue line)

Capture3.PNG

 

Can you post some sample data or the PBIX for us to play with?

I have just figured it out... I had to use ALLSELECTED in my formula instead of ALL

Net OPEN = 
    CALCULATE (
        SUM ( 'Open'[Open] ) ,
        FILTER ( ALLSELECTED ( 'Open' ), 'Open'[Index] <= MAX( ( 'Open'[Index] ) )
    ))

Capture.PNG

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.