Forum Discussion
Ughd
3 years agoNew Member
Dax formula to filter table
Hi, I have text data visualised in a table in Powe bi. European Union is also available in data as a country. Requirement is to custom filter table in a way that if user select any EU country fro...
- Anonymous3 years ago
Hi Ughd ,
Please replace before dax formula with below dax formula:
Measure = VAR a = SELECTCOLUMNS ( 'Table 2', "CT", [Country] ) VAR str = CONCATENATEX ( a, [CT] ) VAR b = CALCULATETABLE ( VALUES ( 'Table 2'[Is European Union Country] ), FILTER ( ALL ( 'Table 2' ), CONTAINSSTRING ( str, 'Table 2'[Country] ) ) ) VAR str2 = CONCATENATEX ( b, [Is European Union Country] ) VAR cur_country = SELECTEDVALUE ( 'Table'[Country] ) VAR val = SWITCH ( TRUE (), CONTAINSSTRING ( str2, "Yes" ), IF ( CONTAINSSTRING ( str, cur_country ) || cur_country = "Europen Union", 1 ), NOT ( CONTAINSSTRING ( str2, "Yes" ) ), IF ( CONTAINSSTRING ( str, cur_country ), 1 ) ) RETURN IF ( NOT ( ISFILTERED ( 'Table 2'[Country] ) ), 1, val )Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
eliasayyy
Memorable Member
3 years agoyou need to show us the tables please
Ughd
3 years agoNew Member
Hi,
Below are the screen shots. Fact table is very simple with 4 fields, country, doc name, description, contact person.
- eliasayyy3 years ago
Memorable Member
ok it looks like you are using 1 table since european country is under countries powerbi cant tell which country is inside the eu, you need to maybe add a new column that says which countries are part of the eu