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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
belvoir99
Resolver III
Resolver III

Cross Slicing - using DAX to change the filter

I have some survey data example. There are 4 respondents who have answered two questions: Bundle and Provider (short hand for each question). Provider is a single answer type question (e.g. radio button) whereas Bundle is a multi-answer type question (e.g. checkboxes). Their answers are shown in the form of "Q8A1" etc but obviously in the real world problem they would be more meaningful.

belvoir99_0-1659353152714.png

I want to cross slice by clicking on the top left table's Q8A1 column. There are 3 respondents for this. On the cross slice to the Bundle visual (top right) I want to count only those responses from those 3 respondents - returning 1 for Q10A1, 4 for Q10A4 and nothing for Q10A3.
This is the data table:

RespQuestionAnswer

R1BundleQ10A3
R2BundleQ10A1
R3BundleQ10A3
R4BundleQ10A3
R1BundleQ10A4
R2BundleQ10A4
R3BundleQ10A4
R4BundleQ10A4
R1ProviderQ8A1
R2ProviderQ8A1
R3ProviderQ8A2
R4ProviderQ8A1

Here is the OneDrive link to the PBIX file: Survey PBIX file 

The DAX measures in the PBIX file - please ignore my hopeless attempts to solve this problem!

Any help gratefully received! Thanks so much.

1 ACCEPTED SOLUTION
belvoir99
Resolver III
Resolver III

I'm closing this as unresolvable. 

 

It's clear to me that, when a cross-filter is passed to another bar chart visual , you cannot add to, amend or remove that filter. It is one area in which we don't have control over the filter context.

 

Back to the client to discuss alternatives!

View solution in original post

2 REPLIES 2
belvoir99
Resolver III
Resolver III

I'm closing this as unresolvable. 

 

It's clear to me that, when a cross-filter is passed to another bar chart visual , you cannot add to, amend or remove that filter. It is one area in which we don't have control over the filter context.

 

Back to the client to discuss alternatives!

belvoir99
Resolver III
Resolver III

Just as an additional thought:

although when you cross slice it passes a filter in the form of 

 

 

  VAR __DS0FilterTable = 
    TREATAS({"Q8A1"}, 'RespondentAnswers2'[Answer])

 

 

It seems to apply this filter after any CALCULATE statement, e.g. any measure acting on the receiving visual will, in DAX Studio, return a syntax such as (stripped down):

 

 

DEFINE
  VAR __DS0FilterTable = 
    TREATAS({"Q8A1"}, 'RespondentAnswers2'[Answer])

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      'RespondentAnswers2'[Answer],
      __DS0FilterTable,
      "MyMeasure", 
      COUNTROWS(
		    CALCULATETABLE( 
		        RespondentAnswers2,
		        REMOVEFILTERS(RespondentAnswers2[Answer])
	       )
       )
    )

EVALUATE
  __DS0Core

 

 

The calculation returns:

belvoir99_0-1659356466409.png

which seems to indicate the TREATAS cross slicer is applied after the CALCULATE statement... in which case I need to restructure the table and not try to find a solution through DAX.

 

Another way to think about it is to say that the __DS0FilterTable is in effect filtering the  'RespondentAnswers2'[Answer] table before applying the measure (to deliver the X axis) and I can't influence that...?

 

At https://dax.guide/summarizecolumns/ SQLBI explain the FilterTable as:

An expression that defines the table from which rows are to be returned.

I would be very happy if someone has a solution - including changing the shape of the table, breaking it up into a star schema, etc etc

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.