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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

COUNTX doesn't do what I expect for a dataset

I have a table with a measure that produces one of several states or a blank space, and then I filter out the blanks. Then, underneath that table, I have a bunch of cards that just show the count of rows that are filtered into another column and the year selected. However, one card in particular doesn't behave the same as the others, and I can't understand why.

The "UNKNOWN" project count is always the total count of UNKNOWN projects for the selected location, regardless of the year, while all other cards show only the count of projects displayed for that selected year based on that status field. See below (sorry for all the redactions). For the year I selected, only one UNKNOWN project is shown in the table, but the count in the white box is 11 – the total number of UNKNOWN projects the site has.

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

Hi @Rakeshadmin ,

You can create a measure as below to get the count of UNKNOWN projects:

CountOfUnknownProjects =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Project] ),
    FILTER ( 'Table', 'Table'[Status] = "UNKNOWN" ),
    REMOVEFILTERS ( 'Table'[Year] )
)

 

If the above ones can't help you figure out, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And 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

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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share some data, explain the question and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yiruan-msft
Community Support
Community Support

Hi @Rakeshadmin ,

You can create a measure as below to get the count of UNKNOWN projects:

CountOfUnknownProjects =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Project] ),
    FILTER ( 'Table', 'Table'[Status] = "UNKNOWN" ),
    REMOVEFILTERS ( 'Table'[Year] )
)

 

If the above ones can't help you figure out, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And 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

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.