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
Julian_S
Frequent Visitor

Is there a way to only apply filters to specific columns?

Hi everyone

 

I have a matrix in my report with a number of KPIs on the columns, and the organisation structure (companies, departments, people) on the rows. I've been asked if it is possible to exclude certain departments from the report, which of course I can do very simply using the filters pane, and just de-selecting the departments that aren't needed.

 

HOWEVER! 

 

The more complicated part is that the requestor only wants the department exclusions to apply to SOME of the report columns and not all. Is there any way to use the functionality in the standard filter pane but apply the action to a specified set of columns?

 

This is a simple example of what I would like to achieve, mocked-up in Excel to show the requirement:

 

Screenshot_1.jpg

 

The columns that are to be filtered and the ones that should remain unfiltered are static (i.e. I could define them and they won't change) but I'd like to try and do this using the filters pane if possible, so that the report user can freely-select which parts of the organisational structure to include or exclude as they need to.

 

Grateful for any hints on whether this is possible or not, and if so, how to achieve it?

 

Julian

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi, @Julian_S 

You could try this way as below:

Step1:

Create three dim tables (companies, departments, people), Then create the relationship with fact table and keep all the relationship is inactive.

6.JPG

Step2:

Use fields from these three dim tables for slicer.

Step3:

For the columns that you want to be applied filter, you could use this formula to create a measure

Measure Qty = 
CALCULATE (
    SUM ( 'Table'[Qty] ),
    USERELATIONSHIP ( 'Dim Company'[Company], 'Table'[Company] ),
    USERELATIONSHIP ( 'Dim Department'[Department], 'Table'[Department] ),
    USERELATIONSHIP ( 'Dim Employee'[Employee], 'Table'[Employee] )
)

For the columns that you don't want to be applied filter, you could use this formula to create a measure

Measure Target = CALCULATE(SUM('Table'[Target]))

Step4:

Then when creating the matrix visual, use companies, departments, people from fact table.

Result:

7.JPG

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Lin, thanks for your reply, I will try your suggestion and see if I can make it work for my circumstance. At the moment I do not have separate dim tables - everything is contained in one query result set as the data comes from a relational source, with columns for all the levels of the organsiation dimension and the measures (KPIs) like so:

 

Screenshot_2.jpg

 

Can I keep the data in one table like this and use a self-reference in the USERELATIONSHIP function, e.g. USERELATIONSHIP ('Table'[Company], 'Table'[Qty])? I'm very new to DAX so I don't yet understand its limitations.

 

Many thanks for your help

 

Julian

hi, @Julian_S 

You could use New table to create these dim tables and then create the inactive relationship as above.

And it could not keep the data in one table like this and use a self-reference in the USERELATIONSHIP function.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.