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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
pitcraj
Helper I
Helper I

Count the number of States individually which are "Met" and are "Not Met" from Status field

Hi,

I have a simple measure (Difference) where it's a subtraction between a Column (Target) and a Measure(Result)
and also a measure (Status) deriving from Difference, where the Difference is >0 its "Met" otherwise "Not met".

This is all good till here, now I want to count the number of "Met" and "Not met" Status values from Status.

Note:
Target is internal Column
Result is a measure
Difference is a measure ( Target - Result)
Status is a Measure (Status = IF([Difference]>=0,"Met","Not Met")

Now I tried to count the States that are status "Met" by using the below measure:
Count of Met States = COUNTX(TableName, [Status]="Met")

and the error is - "the Function Countx cannot work with values of type Boolean"

Please let me know the possible solution. Appreciate your help!  Thanks

PB_Community.PNG

 

1 ACCEPTED SOLUTION

Hi @pitcraj ,

I created a sample pbix file(see the attachment) base on your provided info,  please check if that is what you want.

Count of Met States = COUNTROWS ( FILTER ( 'Test', [Status] = "Met" ) )
Count of Not Met States = COUNTROWS ( FILTER ( 'Test', [Status] = "Not Met" ) )

yingyinr_0-1672223292779.png

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

7 REPLIES 7
pitcraj
Helper I
Helper I

Hi Pat, 

I have tried as you said, however it throws an error like below:

Count of Met States = COUNTROWS(FILTER(Measures_Table, [Status]="Met")

error like this: "Measures_Table" cannot be used in computation becuase it does not have any columns"

Note: Status is not the column in any table its a measure that I have created in the Measures_table

Hi @pitcraj ,

In order to make troubleshooting and give you a suitable solution, could you 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 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.

Hi Yingyinr,

PB_Community1.PNG

Thanks for coming back, I just want to count the number of the boolean value = "Met",
These boolean values either Met/Not Met are coming from a measure that is in my Measures_Table note this is not the column from any table. This is a created measure.
What I am looking for is a way to count rows of "Met" values from the measure applied.

I have tried using

Count of Met States =COUNTROWS ( FILTER ( TableName, [Status] = "Met" ) )

 

and an error out saying "A table of multiple values was supplied where a single value was expected",

Note: the main issue hear the Status field is not coming from a table as a column, it's the measure that was created on the go.

 

Regards

Raaz

 

 

Hi @pitcraj ,

I created a sample pbix file(see the attachment), it can work when I used the same formula of measrue [Count of Met States]... Is [Status] a measure or calculated column? Could you please edit my attached pbix file with your scenario and send it back to me? Later I can make troubleshooting it and give you a suitable solution.

yingyinr_0-1672135736142.png

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.

PB_Community2.PNG

 Thank you so much Yingyinr,

for simplicity Please Create a Test table like in the screenshot attached, I wasn't able to send in the link because my drives are in full, X and Y are some random numbers columns,

whereas (X-Y) and (Status) are measures created like on the screenshot, now all I need is to count the "Met" and "Not met" rows separately and use them in the two different Cards.

 

Regards

Raaz

 

 

Hi @pitcraj ,

I created a sample pbix file(see the attachment) base on your provided info,  please check if that is what you want.

Count of Met States = COUNTROWS ( FILTER ( 'Test', [Status] = "Met" ) )
Count of Not Met States = COUNTROWS ( FILTER ( 'Test', [Status] = "Not Met" ) )

yingyinr_0-1672223292779.png

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.
ppm1
Solution Sage
Solution Sage

Please try this approach instead

 

Count of Met States =
COUNTROWS ( FILTER ( TableName, [Status] = "Met" ) )

 

Pat

Microsoft Employee

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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