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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Help with a measure: Counting rows.

Hello,

I need some halp with a simple DAX query.

 

I have a table of facts that contains, amongst other things, a created date column ([credte]), a closed date column ([clomatdte]) and a fee earner code ([solcde])

 

In addition to the fact table (lgmattrr) I have a date table and a fee earners table (lgsoltrr). On the report page there are slicers to filter the fee earner table and filter the date. The date table is related to [credte] (created date)

 

In my visual I need to count the rows where there is no closed date (the matter is still open). I need a measure that shows the number of matters opened within the selected date range that have no closed date. This is easy:

 

Open Matters = 
COUNTROWS(
    FILTER(
        lgmattrr,
         ISBLANK( lgmattrr[clomatdte] ) )
     )

 

I also need one to show the all-time open matters per fee earner, so I need the measure to ignore the date filter but include the filter for [solcde].

 

I've tried a few things using ALL() and ALLEXCEPT() but they always show the same number across all fee earners.

 

As a workaround I referenced the facts table in Power Query, filtered by clomatdte = null dropped all the columns except fee earner and related that to the fee earner table, then do a simple countrows() across that. Seems like a bit of a kludge though, I'd love to know how to do this in DAX without creating new tables in the model, if possible.

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Would you please try to use the following measure:

Open Matters =
CALCULATE (
    COUNTROWS ( lgmattrr ),
    FILTER ( lgmattrr, ISBLANK ( lgmattrr[clomatdte] ) ),
    ALL ( 'Date Table' )
)

 

If this post help, please consider accept it as the solution to help other member find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

5 REPLIES 5
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Would you please try to use the following measure:

Open Matters =
CALCULATE (
    COUNTROWS ( lgmattrr ),
    FILTER ( lgmattrr, ISBLANK ( lgmattrr[clomatdte] ) ),
    ALL ( 'Date Table' )
)

 

If this post help, please consider accept it as the solution to help other member find it more quickly.

 

Best Regards,

Dedmon Dai

Ashish_Mathur
Super User
Super User

Hi,

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
jdbuchanan71
Super User
Super User

@Anonymous 

Does this give you what you are looking for?

 

All Time Open =
CALCULATE ( [Open Matters], ALL ( Date ) )

This simply calculates your [Open Matters] measure as if there were no filters on the date table.

 

Anonymous
Not applicable

This gives me the same result as the Open Matters measure unfortunately.

willpage_0-1615856387787.png

 

@Anonymous 

I'm not sure what the problem is.  Can you perhaps share a deidentified version of your pbix?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.