Forum Discussion
Filtering visuals using slicers combinations
- 1 year ago
Hi Bimbone ,
Thank you for reaching out to us on the Microsoft Fabric Community Forum.
Please post regarding the same in the issues forum for wider visibility:
Issues - Microsoft Fabric Community
If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.
Hey there!
Here are a few solutions for you:
1. Ensure Correct Relationships Between Tables
- Verify that the Competizione, Anno (Year), and CittaMain (City) fields are properly related in your data model.
- The main table (CoppeCitte) should be linked to the slicer tables via one-to-many relationships.
- If using a separate slicer table, ensure itβs correctly related to CoppeCitte.
2. Use a Measure to Filter "SFPairs" Dynamically
Create a DAX measure to check if the selected slicer values match the records in the table:
SelectedSFPairs =
VAR SelectedComp = SELECTEDVALUE( CoppeCitte[Competizione] )
VAR SelectedYear = SELECTEDVALUE( CoppeCitte[Anno] )
VAR SelectedCity = SELECTEDVALUE( CoppeCitte[CittaMain] )
RETURN
IF(
SELECTEDVALUE( CoppeCitte[SFPair] ) IN
FILTER(
CoppeCitte,
CoppeCitte[Competizione] = SelectedComp &&
CoppeCitte[Anno] = SelectedYear &&
CoppeCitte[CittaMain] = SelectedCity
), 1, 0
)
Hope this helps!
ππ
Hi freginier ,
thank you for your reply. However, I have the following error when I create the measure you suggested:
"The number of arguments is invalid. Function CONTAINSROW must have a value for each column in the table expression."
Why would it happen?
- freginier1 year agoSolution Sage
Hey there,
This happens because the CONTAINSROW function requires all columns of the table expression to be specified.
You need to ensure that all required columns are correctly referenced. Hereβs how you can modify the measure:
SelectedSFPairs =
VAR SelectedComp = SELECTEDVALUE(CoppeCitte[Competizione])
VAR SelectedYear = SELECTEDVALUE(CoppeCitte[Anno])
VAR SelectedCity = SELECTEDVALUE(CoppeCitte[CittaMain])RETURN
IF(
CONTAINSROW(
VALUES(CoppeCitte),
CoppeCitte[Competizione], SelectedComp,
CoppeCitte[Anno], SelectedYear,
CoppeCitte[CittaMain], SelectedCity
), 1, 0
)Then use SelectedSFPairs as a visual filter on the table and set it to 1 so only matching records are displayed.
Hope this helps!
ππ
- Bimbone1 year agoHelper I
Hi again freginier ,
thanks for the suggestion, but I still have some errors, as it says it "Cannot find name [Competizione] and "Cannot find name [Anno]" and "Cannot find name [CittaMain"] , in the bottom part of the code (after the VALUES)
- freginier1 year agoSolution Sage
Hey there!
The issue is because Power BI cannot recognize the column names, check if the column names are correct in the CoppeCitte table, if the names aren't exactly the same it wont work as Power Bi is very sensitive! Also maybe CoppeCitte isn't the correct table name, check that this is correct too.
If after you checked and it is still not working, try using this DAX formula (it uses ALLSELECTED() Instead of VALUES())
SelectedSFPairs =
VAR SelectedComp = SELECTEDVALUE(CoppeCitte[Competizione])
VAR SelectedYear = SELECTEDVALUE(CoppeCitte[Anno])
VAR SelectedCity = SELECTEDVALUE(CoppeCitte[CittaMain])RETURN
IF(
LOOKUPVALUE(
CoppeCitte[SFPair],
CoppeCitte[Competizione], SelectedComp,
CoppeCitte[Anno], SelectedYear,
CoppeCitte[CittaMain], SelectedCity
) <> BLANK(),
1,
0
)And remember to add SelectedSFPairs as a visual-level filter. Set it to "is 1" to only show the filtered records.
If the problem stilllll persists, try to refresh your data model (Home > Refresh).
Restart Power BI to ensure it recognizes recent changes.If this still doesn't work I am not sure how to help ahahhah. Hope this works for you ππ