Forum Discussion

ldamato's avatar
ldamato
Frequent Visitor
4 years ago
Solved

Create a matrix from 2 tables and do operations the minimum value of each table

Hi, 

 

I have 2 tables with the same structure but different data: 

I figured out, with the great help of tamerj1, on this topic: Combine 2 tables into one matrix , how to create a matrix using them to show each column as a row and each table as a column, then getting the minimum value of each. Like this one: 


Problem is, when I tried to add a new column, which should calculate (PREV MAX - CURRENT MAX) and (PREV MIN - CURRENT MIN) and get something like: 

 

I spent the entire day researching and trying yesterday and didn't come even close. 

 

Thanks for the help

 

  • ldamato 

    This requires a bet of dax. You need to use the column totals and force it to view the difference. You can rename it as "DELTA"

    you need to adjust the max and min measures as follows 

    MIN =
    VAR NormalValue =
        MIN ( table[Value] )
    VAR PreviousValue =
        CALCULATE ( MIN ( table[Value] ), table[Attribute] = "Previous" )
    VAR CurrentValue =
        CALCULATE ( MIN ( table[Value] ), table[Attribute] = "Current" )
    RETURN
        IF (
            HASONEVALUE ( table[Attribute] ),
            NormalValue,
            PreviousValue - CurrentValue
        )

1 Reply

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    ldamato 

    This requires a bet of dax. You need to use the column totals and force it to view the difference. You can rename it as "DELTA"

    you need to adjust the max and min measures as follows 

    MIN =
    VAR NormalValue =
        MIN ( table[Value] )
    VAR PreviousValue =
        CALCULATE ( MIN ( table[Value] ), table[Attribute] = "Previous" )
    VAR CurrentValue =
        CALCULATE ( MIN ( table[Value] ), table[Attribute] = "Current" )
    RETURN
        IF (
            HASONEVALUE ( table[Attribute] ),
            NormalValue,
            PreviousValue - CurrentValue
        )