Forum Discussion

alanc's avatar
alanc
Frequent Visitor
2 years ago

Visual Matrix - controlling filter on another visual

Hi All - I have been struggling with filtering on matrix visual. I have two visuals, Table A visual Matrix and Table B visual. I have a heirachry as shown below on A where I only want the 3rd level (tagid) to pass that value to Table B. This is a 1:M relationship. I have tried creating measure using PATHLENGTH on Table A to get the heiarchy level and then use a Measure on B to evaluate the heirarchy on row level selected.  Not getting the desired result.

 

If any of the higher levels are selected then all the tagID's are shown in Table B which is nonsensical.  Note that the highest level is a measure that combines the values of multiple columns to get the data I want to show.  Ideally i would want to clear Visual B if the focus is set on a row anywhere in the list above level 3.

 

Is there a better way to approach this?  thanks for your help.

 

 

 

3 Replies

  • TheoC's avatar
    TheoC
    Community Champion

    Hi alanc 

     

    If I am looking at the visuals correctly, Visual A has a hierarchy of LevelKeys, ItemNumber, TagID (i.e. L1, L2 and L3).  In Visual B, ItemNumber (i.e. Visual A's L2) is the L1.  If you place the ItemNumber in Visual B infront of the TagID, it may help.  

     

    Please note, without seeing the model and both visual structures, I can't guarantee this will fix the problem. But hopefully it will help.

     

    All the best.

     

    Theo

     

    • alanc's avatar
      alanc
      Frequent Visitor

      Thanks for responding but that's not the answer, Visual B is just a cut and paste of sample data not the actual (can't share it)... moving the fields around in B won't solve the problem, in all cases the tagid(s) is passed. I'm just trying to limit it.  Please see the 2nd para of my writeup.

  • TheoC's avatar
    TheoC
    Community Champion

    Try the following:

     

    Measure #1
    SelectedLevel = 

    VAR _CurrentPath = SELECTEDVALUE ( TableA[HierarchyPath] )
    RETURN
    PATHLENGTH ( _CurrentPath )

     

    Measure #2

    FilterByTagID =
    VAR _SelectedTagID = SELECTEDVALUE ( TableA[tagID] )
    VAR _HierarchyLevel = [SelectedLevel] 
    RETURN
    IF ( _HierarchyLevel = 3 && NOT ISBLANK ( _SelectedTagID ) , COUNTROWS ( FILTER ( TableB , TableB[tagID] = _SelectedTagID ) ) , BLANK() )

     

    You'll need to apply the filter measure to Visual B to ensure the data in Visual B relates to the tagId selected in Visual A.  You're also going to need to use Edit Interactions from Visual A to B.

     

    Obviously, you'll need to modify Measure#2 to your specific table / column names. I haven't validated syntax so may need slight modification.