Forum Discussion

jaybears130's avatar
jaybears130
Frequent Visitor
3 years ago
Solved

Total Values in a column based on another column and display in a matrix visual

This is my first time posting here but I have a table of data containing the type of steel item (i'm in construction) and the total tonnage for each model version that I upload to power bi.  The stee...
  • andhiii079845's avatar
    3 years ago
    Hello,
     
    perhaps this help you, its a measure
    priv =
    VAR __version =
        SELECTEDVALUE ( Tabelle1[Model Version #] )
    VAR __cat =
        SELECTEDVALUE ( Tabelle1[Category Name] )
    RETURN
        IF (
            HASONEFILTER ( Tabelle1[Category Name] ),
            SUMX (
                FILTER (
                    ALL ( Tabelle1 ),
                    Tabelle1[Model Version #] = __version - 1
                        && Tabelle1[Category Name] = __cat
                ),
                Tabelle1[Tons]
            ),
            SUMX (
                FILTER ( ALL ( Tabelle1 ), Tabelle1[Model Version #] = __version - 1 ),
                Tabelle1[Tons]
            )
        )