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
Anonymous
Not applicable

Measure to get number of rows in a table with crossfiltering

Hello,

Lets say I have a table called dim_clusters and another called dim_countries.
Clusters have a relationship with countries, and selecting a cluster on a slicer/filter will filter the dim_countries table

 

I am trying to create a measure, that will tell me how many countries it exists based on a slicer selection.
I used the LEN,calculatetable,filter,values but I can never get the right number...

Either I get the number of all rows or the number of rows that I select directly on dim_country slicer.

It should ignore the filter applied on dim_country, but it should take into consideration filters applied on dim_clusters table.

How can I achieve this?

Thank you!

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

here you will find a little PBIX

 

Not sure if I understand your requirement correctly, but from my point of view this report look quite good:

 

image.png

 

I created this DAX statement

No = 
CALCULATE( 
    COUNTROWS(
        'Country'
    )
    ,ALL('Country'[Country])
    ,VALUES('Country'[Cluster])
)

The measure results to 2 due to the fact, that the slicer from the country column reduces the the country table and there are just 2 countries in the same cluster as the filtered country Germany.

 

Hope this is what you are looking for

 

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

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

here you will find a little PBIX

 

Not sure if I understand your requirement correctly, but from my point of view this report look quite good:

 

image.png

 

I created this DAX statement

No = 
CALCULATE( 
    COUNTROWS(
        'Country'
    )
    ,ALL('Country'[Country])
    ,VALUES('Country'[Cluster])
)

The measure results to 2 due to the fact, that the slicer from the country column reduces the the country table and there are just 2 countries in the same cluster as the filtered country Germany.

 

Hope this is what you are looking for

 

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
Anonymous
Not applicable

Yes, this solution works :).

Thank you.
Cheers!

Helpful resources

Announcements
Europe Fabric Conference

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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