Forum Discussion

stefanycheck's avatar
stefanycheck
Frequent Visitor
8 years ago
Solved

Comparing values in the same column

Hi!  I'm plotting data from MySQL to analyse data from a temperature sensor and I have a graphic showing its reading, an indicator showing the mean and cards showing the min and the max readings. So...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hey stefanycheck

     

    I can't see your data but I have an idea for you. You easily can go in the query editor and add an index column. This will sequentially rank your data and we can use these indexes in a calculated column. Something like:

     

    OutlierColumn =
    VAR CurrentIndex = SELECTEDVALUE(Table[Index])
    RETURN
    IF(
       ABS(
       CALCULATE(
          MAX(Table[Temperature]),
          FILTER(
             ALLSELECTED(Table),
             TableIndex = CurrentIndex
          )
       ) -
       CALCULATE(
          MAX(Table[Temperature]),
          FILTER(
             ALLSELECTED(Table),
             TableIndex = CurrentIndex - 1
          )
       )) >= 10,
       0,
       1
    )

    If I wrote that correctly, you are grabbing the current temperature and the temperature of the row above it. You subtract the two and take the absolute value. If the absolute value is greater than or equal to 10, the new column is set to 0. If it is within 10, it is given a 1. You can then bring this new column into the Visual level filters and filter for where OutlierColumn = 1.

     

    Hope this helps!

    Parker