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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jas_power
Helper I
Helper I

Filter table visual by fields in the data table but not included in the table visual

Hi,

   I am struggling to come up with a solution. I have set up 9 unconnected slicers to act as 'or' conditions to filter a table. I have a measure that works to apply the or conditions based on the 9 slicer selections (corresponding to 9 fields in my data table). This works great to filter my big data table. 

   Now I want to create a subset of that filtered table visual showing only the distinct values from one of the fields which is a text field. I can't figure out how to filter a table by fields that are not in the table visual itself. Is this possible?

 

I have a SAS background and would do this in SAS:

 

select distinct customerName

from customerTable

where customerLocation in ('Ontario','Quebec') or customerAge in ('25') or customerType in ('Value','Rewards Member')

 

Where customerLocation, customerAge, customerType are slicers (except there are 9) and each slicer is its own separate unconnected table and the values for those slicers are also fields in the customerTable.

3 REPLIES 3
jas_power
Helper I
Helper I

I found a measure on another thread that I was able to adapt which gives me the result I want, just not in the right format

 

This:

VAR TEMP =
    CALCULATETABLE (
        VALUES ( currentInScopeMap_Final[customerId] ),
        FILTER (
            currentInScopeMap_Final,
currentInScopeMap_Final[customerName]
    in values(currentInScope_customerName[classCode])||
currentInScopeMap_Final[customerCity] 
    in values(currentInScope_customerCity[classCode])||
currentInScopeMap_Final[customerAge] 
    in values(currentInScope_customerAge[classCode])||
currentInScopeMap_Final[customerType] 
    in values(currentInScope_customerType[classCode])
        )
    )
RETURN
    CONCATENATEX ( temp, [customerId], ", " )

produces the following 1 row table: 

4851, 4891, 7253, 7255, 7256, 7257, 7258, 7259, 7261, 7262, 7263, 7264, 7278, 7288, 7333

 

What I need is for each of those values to be on separate rows. Any ideas on how I could adapt the measure accordingly?

amitchandak
Super User
Super User

@jas_power , Assume you have col1 table not used in visual

 

calculate(sum(Table[Value]), filter(Table, Table[Col1] in values(Slicer1[Col1]) ) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak thank you for that. It looks like it will work for filtering a table by a field that is not in the visual. I have two issues now: 

1) My (table[value]) is a text field so I can't use sum and am unsure what to put in its place because I need it to return a distinct list of text values.

2) Do I just add || to connect multiple or conditions:

calculate(sum(Table[Value]), filter(Table, Table[Col1] in values(Slicer1[Col1])||values(Slicer2[Col2]||... ) )

 

Thanks

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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