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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ghaines
Resolver I
Resolver I

ISFILTERED and "Column aliases"

I'm using a calculated table (a union of different columns), and then detecting filters applied from a different matrix visual in order to dynamically change the axis of a chart visual.

 

Since the different values that can be used to filter from one visual to another are in hierarchy, I am using ISFILTERED in order to test whether something is directly filtered as ISCROSSFILTERED will not work as intended.

 

However, when I change the display name of the field within the visual (i.e. Add the column "CUSTOMER_FULL_NAME" to the visual and then edit the name to be "Customer") then the behaviour changes, apparently the original field is no longer directly filtered?

 

How can I account for this, or must I not edit the name for ISFILTERED to work?

Code not really required, but here you go:

 

Table:

 

Country SR Customer Slicer = 
VAR CountryTable = CROSSJOIN(
    ROW("Type", "Country"), VALUES(Country[Country]))
VAR SalesRepTable = CROSSJOIN(
    ROW("Type", "Sales Rep"), VALUES('Sales Reps'[Sales Rep]))
VAR CustomerTable = CROSSJOIN(
    ROW("Type", "Customer"), VALUES('All Customers'[CUSTOMER_FULL_NAME]))

RETURN
FILTER(
    UNION(UNION(CountryTable,SalesRepTable), CustomerTable),
    NOT ISBLANK([Country])
)

 

Second column name in table defaults to "Country", so that column is filtered.  Column then manually changed to "Key".

 

Return Measure:

 

SalesWithCountryRepCustomerHierarchy = 
VAR CustomerLevel = ISFILTERED('All Customers'[CUSTOMER_FULL_NAME])
VAR SalesRepLevel = ISFILTERED('Sales Reps'[Sales Rep])

VAR CustomerList = INTERSECT(VALUES('All Customers'[CUSTOMER_FULL_NAME]), VALUES('Country SR Customer Slicer'[Key]))
VAR SalesRepList = INTERSECT(VALUES('Sales Reps'[Sales Rep]), VALUES('Country SR Customer Slicer'[Key]))
VAR CountryList = INTERSECT(VALUES(Country[Country]), VALUES('Country SR Customer Slicer'[Key]))
RETURN
SWITCH(TRUE(),
    CustomerLevel, 
    CALCULATE([Sales], 
        FILTER('Country SR Customer Slicer', 'Country SR Customer Slicer'[Type] = "Customer"),
        TREATAS(CustomerList, 'All Customers'[CUSTOMER_FULL_NAME])
    ),
    SalesRepLevel, 
    CALCULATE([Sales], 
        FILTER('Country SR Customer Slicer', 'Country SR Customer Slicer'[Type] = "Sales Rep"),
        TREATAS(SalesRepList, 'Sales Reps'[Sales Rep])
    ),
    CALCULATE([Sales], 
        FILTER('Country SR Customer Slicer', 'Country SR Customer Slicer'[Type] = "Country"),
        TREATAS(CountryList, Country[Country])
    )
)

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@ghaines , create this table as a Var in measure, calculated table and column, can not use slicer value. do that will not work

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

Are you saying this expression will have no effect?

 

 

FILTER('Country SR Customer Slicer', 'Country SR Customer Slicer'[Type] = "Customer")

 

I do need a calculated table because the key column in the visualisation legend.  But knowing that the slicer is not working and that it's just that there are no keys common to country, rep or customer is good to know.  Thanks.

 

Helpful resources

Announcements
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.