Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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
R1 | Bundle | Q10A3 |
R2 | Bundle | Q10A1 |
R3 | Bundle | Q10A3 |
R4 | Bundle | Q10A3 |
R1 | Bundle | Q10A4 |
R2 | Bundle | Q10A4 |
R3 | Bundle | Q10A4 |
R4 | Bundle | Q10A4 |
R1 | Provider | Q8A1 |
R2 | Provider | Q8A1 |
R3 | Provider | Q8A2 |
R4 | Provider | Q8A1 |
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.
Solved! Go to Solution.
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!
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!
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:
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
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
11 | |
9 | |
6 |