Forum Discussion

Otrova's avatar
Otrova
New Member
3 years ago
Solved

Filtering rows in a matrix by using a Measure and a visual filter

Hello Power Bi community. 

 

I'm currently exploring PBI, and its amazing capabilities. 

 

I did a bit of research and Im able to filter row sin a 'TABLE visual' by using a slicer, a measure and adding a visual filter on the table visual! That works great. 

 

In the snapshot below you can see the slicer (1-3), and in the table below you can see the row selected (that row happens to have a count value of 3.

 

The data is quite simple: All I'm interested is in the partNo and the Date (no need for Ccount). I count how may date per PartNo to obtain Count of Cycle count in picture above.

I also have a table two use with the slicer:

 

 

I Have two measures:

 

Count of Cycle_Count =
     COUNT('Cycle_Count'[Date])
 
Count_Filter =
    VAR MinValue = MIN('Count'[Count_No])
    VAR MaxValue = MAX('Count'[Count_No])
VAR CurrentCountValue = [Count of Cycle_Count]
RETURN
   IF( CurrentCountValue >= MinValue && CurrentCountValue <= MaxValue,1,0)
 
And I use a visual filter:

 

 

As I mentioned, this works great with a Table Visual.

 

Now I'm trying to understand the same scenario but using a MAtrix Visual. I assume it must be a bit more complex because the matrix has two level (PartNo and Date). I would like to achieve the same result, that is filter all PartNo that are in the range of the slicer. But, it does not work. Maybe because a scope issue in the Matrix visual, or because the way the PBI groups the data in the matrix. I'm new at this. 🙂

 

I end up selecting all the rows, while I was expecting to select only PartNo 'B'.  The one with Count_Filter = 1

What is the best approach to follow to obtain the same results while using a Matrix?

Thanks in advanced to any one in the community who could give me a hand in understanding the issue.

 

Not sure how to attach a pbix file, at this time.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Otrova ,

     

    Instead of using visual filters, consider use this measure directly.

     

     

    Count_Filter = 
        VAR MinValue = MIN('Count'[Count_No])
        VAR MaxValue = MAX('Count'[Count_No])
    VAR CurrentCountValue = [Count of Cycle_Count]
    RETURN
       IF( CurrentCountValue >= MinValue && CurrentCountValue <= MaxValue,[Count of Cycle_Count])

     

    output.

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

4 Replies