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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Count and DAX

Hi Guys, I am facing issue counting the below rows where the condition is like:

Count number of rows for each group name where

Open date <= Date and resolve date is >= Date. So basically the count for 01-01-2020 would be 30 and for 02-01-2020 should also be 30 even though there is no open date or resolve date for that day.

I have created this table with required columns from the calendar and the fact table.

 

Appreciate your help in advance.

 

image.png

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Create measures.

Measure =
CALCULATE (
    COUNT('Table'[date]),
    FILTER (
        ALL ( 'Table' ),
        'Table'[date] = SELECTEDVALUE ( 'Table'[open date] )
            && 'Table'[date] <= SELECTEDVALUE ( 'Table'[close date] )
            && 'Table'[date] = SELECTEDVALUE ( 'Table'[date] )
    )
)
Measure 2 = COUNTAX(FILTER(ALL('Table'),[Measure]<>BLANK()),[Measure])

 

vpollymsft_0-1675128250958.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

tamerj1
Super User
Super User

Hi @Anonymous 
For a calculated column please use

Count =
COUNTROWS (
    FILTER (
        CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[FactTable.Group Name] ) ),
        'Table'[FactTable.Open Date] <= 'Table'[Date]
            && 'Table'[FactTable.Resolve Rate] >= 'Table'[Date]
    )
)

For a measure you can use

Count =
COUNTROWS (
    FILTER (
        'Table',
        'Table'[FactTable.Open Date] <= 'Table'[Date]
            && 'Table'[FactTable.Resolve Rate] >= 'Table'[Date]
    )
)
FreemanZ
Super User
Super User

hi @Anonymous 

unable to follow. Could you elaborate how you get 30 in your example date, say 01-01-2020?

Anonymous
Not applicable

So the count is basically 30 since the open date is equal to Date and resolve dates are greater than Date. So count of all the tickets falling as per above criteria is 30 for that group name.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.