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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
_Junayetrahman
Frequent Visitor

Count based on condition

Hi all, I need solution for this condition attached in screenshot.

Theere is multiple same BD CODE when filtering V P.doc also has only one BD CODE. I need to take the distinct count of BD CODE and then I need to substract the distict count with the count that has only single row. Please refrer screenshot for more clarification.

Please help. Thanks.

Award answer.PNG

2 ACCEPTED SOLUTIONS
TomMartens
Super User
Super User

Hey @_Junayetrahman ,

 

consider creating a pbix file that contains sample data, but still reflect your data model: tables, relationships, calculated columns and measures. Upload the pbix to onedrive, google drive, or dropbox and share the link. If you are using a spreadsheet to create the sample data instead of the manual input method share the spreadsheet as well.

 

Do not forget to describe the expected result based on the sample data you provide. Also add data visualizations to a report page and describe how you expect the result is "mapped" to the visual(s).

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

Anonymous
Not applicable

Hi @_Junayetrahman ,

You can create a measure as below to get it, please find the details in the attachment.

Count of repeated DB Code = 
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[BD CODE],
        "@count",
            CALCULATE (
                DISTINCTCOUNT ( 'Table'[V Code] ),
                FILTER ( 'Table', 'Table'[BD CODE] = EARLIER ( 'Table'[BD CODE] ) )
            )
    )
VAR _count =
    SUMX ( _tab, [@count] )
RETURN
    COUNTROWS ( FILTER ( _tab, [@count] > 1 ) )

vyiruanmsft_0-1701050781034.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @_Junayetrahman ,

You can create a measure as below to get it, please find the details in the attachment.

Count of repeated DB Code = 
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[BD CODE],
        "@count",
            CALCULATE (
                DISTINCTCOUNT ( 'Table'[V Code] ),
                FILTER ( 'Table', 'Table'[BD CODE] = EARLIER ( 'Table'[BD CODE] ) )
            )
    )
VAR _count =
    SUMX ( _tab, [@count] )
RETURN
    COUNTROWS ( FILTER ( _tab, [@count] > 1 ) )

vyiruanmsft_0-1701050781034.png

Best Regards

TomMartens
Super User
Super User

Hey @_Junayetrahman ,

 

consider creating a pbix file that contains sample data, but still reflect your data model: tables, relationships, calculated columns and measures. Upload the pbix to onedrive, google drive, or dropbox and share the link. If you are using a spreadsheet to create the sample data instead of the manual input method share the spreadsheet as well.

 

Do not forget to describe the expected result based on the sample data you provide. Also add data visualizations to a report page and describe how you expect the result is "mapped" to the visual(s).

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors