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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Ignoring Filter and calculating count

Hi Everyone,

I have a requirement to caluclate distinct "ID's" which are having comments and having comments=blanks() for each user.

I have created two measures to caluclate count of ID's for individual users.

Completed = var av=  CALCULATE(DISTINCTCOUNT('Table'[ID]),'Table'[Comment]<>BLANK())

                                    return   IF(av=BLANK(),0,av)
Incompleted = var ac=  CALCULATE(DISTINCTCOUNT('Table'[ID]),'Table'[Comment]=BLANK())
                                    return   IF(ac=BLANK(),0,ac)
 

 How to look the ID's which are having comments in prev rows. 

 

 

Nishanth1996_0-1663849577477.png

 

Expected result "0" instead of "2", since for user a products 1&2 having comments in prev dates

Nishanth1996_2-1663849636638.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous  ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a calculated column as below:

Maxdate = 
CALCULATE (
    MAX ( 'Table'[Date] ),
    FILTER (
        'Table',
        'Table'[User] = EARLIER ( 'Table'[User] )
            && 'Table'[ID] = EARLIER ( 'Table'[ID] )
    )
)

2. Create two measures to get the count of completed and incompleted IDs

Completed = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[ID] ),
        FILTER (
            'Table',
            'Table'[Date] = 'Table'[Maxdate]
                && 'Table'[Comment] <> BLANK ()
        )
    )
RETURN
    _count + 0
Incompleted = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[ID] ),
        FILTER (
            'Table',
            'Table'[Date] = 'Table'[Maxdate]
                && 'Table'[Comment] = BLANK ()
        )
    )
RETURN
    _count + 0

yingyinr_0-1663926634656.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous  ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a calculated column as below:

Maxdate = 
CALCULATE (
    MAX ( 'Table'[Date] ),
    FILTER (
        'Table',
        'Table'[User] = EARLIER ( 'Table'[User] )
            && 'Table'[ID] = EARLIER ( 'Table'[ID] )
    )
)

2. Create two measures to get the count of completed and incompleted IDs

Completed = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[ID] ),
        FILTER (
            'Table',
            'Table'[Date] = 'Table'[Maxdate]
                && 'Table'[Comment] <> BLANK ()
        )
    )
RETURN
    _count + 0
Incompleted = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[ID] ),
        FILTER (
            'Table',
            'Table'[Date] = 'Table'[Maxdate]
                && 'Table'[Comment] = BLANK ()
        )
    )
RETURN
    _count + 0

yingyinr_0-1663926634656.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

PabloDeheza
Solution Sage
Solution Sage

Hi there!

You could try:
CALCULATE( COUNTROW( 'Table' ), 'Table'[Comment] <> BLANK() )

Let me know if that helps!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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