Forum Discussion

asimpleman9to5's avatar
asimpleman9to5
Frequent Visitor
4 years ago
Solved

Difference between rows

Hi all.    First Photo   Second Photo     From the screenshots shown above, the first photo is how my data is seen now. I would require the serial numbers to be filtered and groupe...
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    Please check the below picture and the attached pbix file.

    It is for creating measures.

     

     

    Voltage measure: = 
    IF ( HASONEVALUE ( Data[Serial No] ), SUM ( Data[Voltage] ) )

     

    Row Diff measure: = 
    VAR _currentvoltage = [Voltage measure:]
    VAR _currentrow =
        MAX ( 'Test Type'[Index] )
    VAR _nextrow =
        MINX (
            FILTER ( ALL ( 'Test Type' ), 'Test Type'[Index] > _currentrow ),
            'Test Type'[Index]
        )
    VAR _nextrowvoltage =
        CALCULATE (
            [Voltage measure:],
            FILTER ( ALL ( 'Test Type' ), 'Test Type'[Index] = _nextrow )
        )
    RETURN
        IF (
            HASONEVALUE ( 'Serial No'[Serial No] ),
            IF ( ISBLANK ( _nextrow ), "null", _currentvoltage - _nextrowvoltage )
        )