Forum Discussion
Comparing Data Across Two Filters in Power BI
- 2 years ago
How about this table?
I also set the filter.
When using the 'SELECTEDVALUE' function, I think the data column you set for the slicer should be different from the base data column.
sirbaklava , You can do it using interactions or Two independent tables for site and item
How Interactions Work- Split Page using interactions to compare - https://youtu.be/GIfRKzhMaR4
Compare Categorical Data Using Slicers - Compare two Brands: https://youtu.be/exN4nTewgbc
Amit - thank you so much for replying to my post. I've been struggling with this issue for the last 3-4 days and I'm starting to run out of ideas here. I took a look at both of your videos and I think they're incredibly helpful. I was already tweaking the interactions to make the filters and viz act independent.
I just tried redoing this with a sample dataset with the columns site and items. Here are the 2 measures for the selected values that we're referencing and using in the card which is chosen from a filter:
Measure for Selected Baseline Site: SelectedBaselineSite = SELECTEDVALUE(sample_data[site])
Measure for Selected Comparison Site: SelectedComparisonSite = SELECTEDVALUE(sample_data[site])
Then I put the 2 filters and put site in them.
Next, I put 2 matrices and I have items in them that correspond to the site. Here are the 2 measures I created to get a yes or no on if the item is found in the other selected site:
- Measure for Baseline Site (checking if the item is in the comparison site):
IsInComparisonSite =
VAR SelectedComparisonSite = SELECTEDVALUE(sample_data[site])
VAR CurrentItem = SELECTEDVALUE(sample_data[item])
RETURN
IF(
COUNTROWS(
FILTER(
ALL(sample_data),
sample_data[site] = SelectedComparisonSite &&
sample_data[item] = CurrentItem
)
) > 0,
"Yes",
"No"
)
Measure for Comparison Site (checking if the item is in the baseline site):
IsInBaselineSite =
VAR SelectedBaselineSite = SELECTEDVALUE(sample_data[site])
VAR CurrentItem = SELECTEDVALUE(sample_data[item])
RETURN
IF(
COUNTROWS(
FILTER(
ALL(sample_data),
sample_data[site] = SelectedBaselineSite &&
sample_data[item] = CurrentItem
)
) > 0,
"Yes",
"No"
)
I made sure that the filters are only affecting their respective site. So filter 1 only affects card 1 and matrix 1, and interactions were turned off for filter 2, card 2, and matrix 2. I did the same thing vice versa.
However, I'm still getting all 'Yes' in the matrices for both using this method. I am not understanding what I am doing wrong. Please help.