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
924pbi
Regular Visitor

DAX help filtering a table visual with an IN list form a calculated table.

I have a CatsColars table from which I have created a calulated table visual that groups cats and collars to show how many cats have the same number of collars. e.g. 2 cats have 4 colars, 1 cat has 3 colars,etc.

By clicking on the number of colars in the colar column of the calculated table visual, i want to filter the CatsColars table to only show those cats with the clicked on number of colars.

e.g. if i click on the "2" in the colars column of the calculated table visual the measure against the CatsColars table should show a 1 for the 4 rows belonging to the two cats with 2 colars;  Link to pbix file  
How do i get the measure to correctly return the 1 and 0 so that i can filter the visual? thanks in advance.

1 ACCEPTED SOLUTION

hi @924pbi ,

 

Create a new table with colar count for each Cat and Use Cat name in this new table to filter main table.

 

-Keep original table CatColars

-Create new table and join this table to CatColars on column [Cat] only in Datamodel.

Table =
ADDCOLUMNS(
                            SUMMARIZE(
                                        CatColars,
                                        CatColars[Cat]
                            ),
                            "ColarCount",
                            VAR _Cat = CatColars[Cat]
                            RETURN COUNTX( FILTER(CatColars, CatColars[Cat] = _Cat), CatColars[Colar])
                )

 

-Create a measure

Meow = COUNTX( 'Table', 'Table'[Cat])

 

talespin_2-1706175374214.png

 

Let me know if any questions.

View solution in original post

5 REPLIES 5
924pbi
Regular Visitor

@talespin awesome, now i also understand how you have maintained lineage. thanks heap

You're welcome.

924pbi
Regular Visitor

Hi @talespin, thanks for reviewing the problem. Is there an alternative way to get a simiar outcome, if not that way? Also not sure i understand completely given i am passing values that do the fitlering and that the count of rows effected is returned correctly. Also, isn't lineage about both tables being derived from the same physical source table, which it is, and the same data type is passed becuase it comes from the same table?

hi @924pbi ,

 

Create a new table with colar count for each Cat and Use Cat name in this new table to filter main table.

 

-Keep original table CatColars

-Create new table and join this table to CatColars on column [Cat] only in Datamodel.

Table =
ADDCOLUMNS(
                            SUMMARIZE(
                                        CatColars,
                                        CatColars[Cat]
                            ),
                            "ColarCount",
                            VAR _Cat = CatColars[Cat]
                            RETURN COUNTX( FILTER(CatColars, CatColars[Cat] = _Cat), CatColars[Colar])
                )

 

-Create a measure

Meow = COUNTX( 'Table', 'Table'[Cat])

 

talespin_2-1706175374214.png

 

Let me know if any questions.

talespin
Solution Sage
Solution Sage

Hi @924pbi ,

 

I do not think it will work, Your calculated table can't filter the actual table.

 

I think its due to Data Lineage, once Data Lineage is broken you can't filter one table with another. Your Main table is text values and Calculated table has numbers(Its not just about data type) but Data Lineage as well.

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.