Forum Discussion

scottbmartin's avatar
scottbmartin
Frequent Visitor
8 years ago

Filter rows to exclude non-changing values

I would like to filter results of a table based on whether the values have changed across columns.

 

 Period 1Period 2Period 3
A111
B122
C 11
D1  
E112

 

In this example, row A would be excluded, as it's value is 1 for all 3 periods.

It is important, that going from 1 to blank (as in Row C) should be considered a change.

 

Thanks for any suggestions!

Scott

2 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi scottbmartin,

     

    Based on my test, we can achieve the goal by the following methods.

     

    1.  Add a custom column in query editor. Filter the table as below, close and apply.

     

    custom = if [Period 1] = [Period 2] and [Period 2]=[Period 3] then 0 else 1

     

    2. Add a calculated column to filter the table.

     

    Column = IF(AND(Table1[Period 1]=Table1[Period 2],Table1[Period 2]=Table1[Period 3]),0,1)

     

    For more details, please check the pbix as attached.

     

    https://www.dropbox.com/s/7zuy1x4zeggirdf/Filter%20rows%20to%20exclude%20non-changing%20values2.pbix?dl=0


    Regards,
    Frank

    • scottbmartin's avatar
      scottbmartin
      Frequent Visitor

      Thanks Frank.

       

      I failed to articulate the underlying data strucuture.  The "Table" that I listed in the original post is an example of a PowerBI Matrix visualization.  The underlying "Table" would look something like this:

       

      ItemPeriodValue
      A11
      A21
      A31
      B11
      B22
      B32
      C21
      C31
      D11
      E11
      E21
      E32

       

      Do you think your approach be applied to this structure?

      Thanks, and sorry for not being more clear in my original post.

      Ideally, I'd like to be able to have the filter criteria respond to the current filter context.  For instance, to allow the user to not only compare the last three periods, but also just the last two, or perhaps 4.

       

      My first thought, was to consider using the STDEVX.P function.  If the row's standard deviation is Zero, then there must be no change in value, and thus should be filtered out.

      Thanks,

      Scott