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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
TusharGaurav
Helper III
Helper III

How to find count of non blank rows based on a calculated measure ?

Hi Expert,

 

I have the following table visual:

Emp NameQuantity Sold
John122
Peter 
Ravi67
Rakesh 
Neha155

Here "Quantity Sold" is a calculated measure.

I need to find the number of non blank rows which is 3 this case i.e.

Emp NameQuantity SoldCount of rows
John1223
Peter 3
Ravi673
Rakesh 3
Neha1553

 

I have tried using below dax:

COUNTROWS(FILTER('Order_table',NOT(ISBLANK([Quantity Sold]))))

But I am not getting the result.

Can you please suggest how to achieve the same?

 

Thanks and Regards,

Tushar Gaurav

2 ACCEPTED SOLUTIONS

Hi @TusharGaurav 
I checked it and allseseleted on table level works perfectly.
(it removes all the filters that come from the table and creates the filter by the measure)

**If you have employees or something similar as dimension it should be applied on this employees dimension table.

Ritaf1983_0-1726850209344.png

The updated Pbix is attached , from here if it won't work I need to see your pbix.

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

@TusharGaurav 
In this case, it sounds like you definitely need a dimension table for employees.
Then, no matter what you do in the calculation, you'll be able to remove filters from the dimension table.
One of the reasons the Power BI engine highly favors "star schemas."

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

10 REPLIES 10
Ritaf1983
Super User
Super User

Hi @TusharGaurav 
You were on the right way 🙂

The formula that is working :

Non_blnk_rows =
CALCULATE(
COUNTROWS(FILTER('Table (2)',NOT ISBLANK([sum_]))),ALLSELECTED('Table (2)'[Emp Name]))
Ritaf1983_0-1726829839153.png

The pbix is attached

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi Rita,

 

Thanks a lot for your Response.

I am sorry there are 2 more column i.e. Team Lead and Sales Person.

Manager NameTeam LeadSalePersonQuantity Sold
JohnRamboArnold10000
JohnRamboTim125
JohnRamboMarry 
PeterNehaRaj123
PeterNehaNarnia 
RakeshRaviBilly45
RakeshRaviMartha29
RakeshRaviSaif35

I have used the below calculation:

Non_blnk_rows =
CALCULATE(
COUNTROWS(FILTER('Sheet1',NOT ISBLANK([Quantity Sold]))),ALLSELECTED('Sheet1'[Manager Name],Sheet1[Team Lead],Sheet1[Team Lead]))

But its not working and I am getting 1 in place of 6.

Can you please help.

Hi @TusharGaurav 
Modify the formula to :

Non_blnk_rows =
CALCULATE(
COUNTROWS(FILTER('Table (2)',NOT ISBLANK([sum_]))),ALLEXCEPT('Table (2)','Table (2)'[Quantity Sold]))
Ritaf1983_0-1726833704015.png

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi Rita,

Thanks again for such prompt response.

Actually "Quantity Sold" is not a column but a calculated measure so I can use it in "All Except" dax.

Is there any alternative.

 

Thanks and Regards,

Tushar Gaurav

Allsellected (table ) sholud work too. 

I am not near the computer , if it wont work let me know and i will check later

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi Rita,

 

Thanks.

Even allselected is not working.

This DAX is also taking column only and not measures.

 

Thanks and Regards,

Tushar Gaurav

Hi @TusharGaurav 
I checked it and allseseleted on table level works perfectly.
(it removes all the filters that come from the table and creates the filter by the measure)

**If you have employees or something similar as dimension it should be applied on this employees dimension table.

Ritaf1983_0-1726850209344.png

The updated Pbix is attached , from here if it won't work I need to see your pbix.

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

It should work because the filter context comes from table...

Please share the link for you pbix file and i will check why it is not working for you 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi Rita,

Thanks.

It working for my sample data of only one table ,but I am using multiple table with some complex calculation.

May be thats why its not working.

Thanks for your help.

 

Thanks and Regards,

Tushar Gaurav

@TusharGaurav 
In this case, it sounds like you definitely need a dimension table for employees.
Then, no matter what you do in the calculation, you'll be able to remove filters from the dimension table.
One of the reasons the Power BI engine highly favors "star schemas."

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

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