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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kimlien3006
Helper II
Helper II

How to count the number of rows after the filter is applied (not distinctcount)

Hi everybody, 

I have a dataset including columns of region, country and  sales. What I want to create is a filter based on region and a chart/card which shows the number of sales and the number of countries according to region. The chart/card need to be dynamic and changed when I change the filter of region. Do you know any measures which can solve this? 

 

Many thanks!

 

sample.jpg

1 ACCEPTED SOLUTION
Sumanth_23
Memorable Member
Memorable Member

hi @kimlien3006 - You can achieve this by creating a measure for Sales and Count of rows - please see screen grabs of how you can implement the same. 

Total Sales = SUM('Region Country Sales'[Sales])
Rows Count = COUNTROWS('Region Country Sales')

 

Sumanth_23_3-1600274699441.png

 

Sumanth_23_4-1600274709972.png

 

Sumanth_23_0-1600274620013.png

Sumanth_23_1-1600274637839.png

Sumanth_23_2-1600274665406.png

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!

Proud to be a Super User!



View solution in original post

7 REPLIES 7
Sumanth_23
Memorable Member
Memorable Member

hi @kimlien3006 - You can achieve this by creating a measure for Sales and Count of rows - please see screen grabs of how you can implement the same. 

Total Sales = SUM('Region Country Sales'[Sales])
Rows Count = COUNTROWS('Region Country Sales')

 

Sumanth_23_3-1600274699441.png

 

Sumanth_23_4-1600274709972.png

 

Sumanth_23_0-1600274620013.png

Sumanth_23_1-1600274637839.png

Sumanth_23_2-1600274665406.png

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!

Proud to be a Super User!



Thanks a lot! It works well. 

hi @kimlien3006 - Happy to help! 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!

Proud to be a Super User!



DebbieE
Community Champion
Community Champion

Ill have a go

 

I set up a dataset

 

dataset.JPG

 

then Created two measures

 

No of Countries in Region = DISTINCTCOUNT('Table'[County]) (Whoops called it county instead of country)
Number of Sales = SUM('Table'[Sales])
 
And added a filter and the two cards
 
regionAM.JPG
 
 

RegionEU.JPG

Im guessing Im off the mark on this one because its quite a simple solution but I think it answers your question on the number of sales and the number of countries according to region

 

Hi @DebbieE  thanks a lot! I also tried your solution. It also works well.

🙂 I realised you post header specified to not use DISTINCTCOUNT. Apologies.  I went straight in for a DISTINCTCOUNT measure

jthomson
Solution Sage
Solution Sage

Why wouldn't you just use countrows in the first instance and sum([sales]) in the second instance?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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