Forum Discussion
PathContains from SelectedValue issue with GUID
- Anonymous1 year ago
Hi Jp_ON ,
Thanks for your detailed reply. I updated my sample pbix file, please check if that is what you want. Please update the formula of measure [HeirarchyRegionInPath] as below:
HeirarchyRegionInPath_New = VAR _Selectedname = SELECTEDVALUE ( 'Region list'[Name] ) VAR _account = SELECTEDVALUE ( 'Units'[Account] ) VAR _terr = CALCULATETABLE ( VALUES ( 'esi_region'[esi_territory] ), FILTER ( 'esi_region', IFERROR ( SEARCH ( _Selectedname, 'esi_region'[Name], 1, 0 ), 0 ) > 0 ) ) VAR _accounts = CALCULATETABLE ( VALUES ( 'account'[Name] ), FILTER ( 'account', 'account'[esi_territory] IN _terr ) ) RETURN IF ( _account IN _accounts, 1 )Best Regards
- 1 year ago
Took a few rounds but this was what we landed on.
Have a Table used for Selecting region(Region list) so that the relationships between tables doesn't restrict the avaialble Regions.
DefineHierarchyPath = PATH(Regions[esi_regionid],Regions[Parent Region (esi_region)])
Then against the Region table this Column is added and we filter the grids based on "RegionInPath is 1"RegionInPath =VAR SelectedRegion = SELECTEDVALUE('Region list'[Region])VAR FilteredTable =FILTER(regions, PATHCONTAINS(Regions[HierarchyPath], SelectedRegion))RETURNIF (ISBLANK(SelectedRegion),1, -- Show all records if no slicer is selectedIF (ISEMPTY(FilteredTable),0, -- Record doesn't match filter1 -- Record matches filter))
Hi Jp_ON - update the IF() logic in the HeirarchyRegionInPath measure
HeirarchyRegionInPath =
VAR SelectedRegion = SELECTEDVALUE('Region list'[Region], BLANK()) -- Use SELECTEDVALUE()
VAR RelatedRegionPath =
LOOKUPVALUE(
ESI_region[HierarchyPath],
esi_region[Region],
RELATED(account[esi_territory])
)
RETURN
IF (
NOT(ISBLANK(SelectedRegion)) &&
PATHCONTAINS(RelatedRegionPath, SelectedRegion),
TRUE(),
FALSE()
)
if the above is logic not working, can you revisiting the relationships between the tables to ensure that the lookup functions are pulling the correct data.