Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Filter corresponding columns

Hi

 

I have a matrix visual with account numbers as columns, journal numbers as rows and amounts as values, ex:

           1000     2000     3000    4000
101        10         -10        

102                      20        -20
103        35          -5         -30
104                      50                 -50

I have added a slicer for account number. When I filter on an account number, I want the matrix to show me the journal numbers with values on this account number, and also the corresponding account numbers/values. For example, if i filter on account number 3000, this is how I want the matrix to look like:

        1000   2000   3000
102                20     -20

103  35         -5       -30

I have tried using different measures, but they all seem to return only the account number I have filtered on. Help is highly appreciated 😄

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Anonymous 

     

    You can try the following methods. Create a new slicer table.

    Slicer = VALUES('Table'[account number])
    Measure = 
    Var _table=CALCULATETABLE(VALUES('Table'[journal number]),FILTER(ALL('Table'),[account number]=SELECTEDVALUE(Slicer[account number])))
    RETURN
    IF(SELECTEDVALUE('Table'[journal number]) IN _table,1,IF(SELECTEDVALUE(Slicer[account number])=BLANK(),1,0))

    Is this your desired outcome? Please review the attachment.

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

5 Replies

  • Hi Anonymous 

     

    you should have a table for your journal numbers (lets call it DimJournal which contains all unique journal numbers) then you should use it as row of your matrix. then write a measure as follows:

     

    measure val := var _selectedjournal = selectedvalue (DimJournal [Journal Id])

    return

    calculate (sum( your_table [value]) , filter (your_table , your_table [journal Id] = _selectedjournal))

     

    ** do not create any relationship between your table and Dimjournal

     

    If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for answering. I tried your solution, but the matrix still only shows the account number that is filtered on, and not the others. 

      • Selva-Salimi's avatar
        Selva-Salimi
        Solution Sage

        Anonymous 

         

        there was a misunderstanding between account and journal. sorry for that. as you want to select an account so you should have account numbers as a unique table (lets call it DimAccount) and then you should use it as slicer. then write a measure as follows:

         

        measure val := var _selectedjournal = selectedvalue (DimAccount [Account Id])

        var _selectedjournal= summarize (filter (all(your_table) , Account in _selectedjournal) , your_table[journal])

        return

        calculate (sum( your_table [value]) , filter (your_table , your_table [journal Id] in _selectedjournal))

         

        the columns of matrix should selected from your_table and there should not be any relation between these two tables.

         

        If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly.

         

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Anonymous 

     

    You can try the following methods. Create a new slicer table.

    Slicer = VALUES('Table'[account number])
    Measure = 
    Var _table=CALCULATETABLE(VALUES('Table'[journal number]),FILTER(ALL('Table'),[account number]=SELECTEDVALUE(Slicer[account number])))
    RETURN
    IF(SELECTEDVALUE('Table'[journal number]) IN _table,1,IF(SELECTEDVALUE(Slicer[account number])=BLANK(),1,0))

    Is this your desired outcome? Please review the attachment.

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      That worked just the way I wanted! Thank you so much for helping me