Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Create a total table from an other table

Hi,

 

I have a data table like this : 

 

I want to create a new table with the total (direct + toller) for each year (2021 and 2022)

And the percentage of direct (direct value / direct value + toller value)

The table I need is this : 

If someone can help me, thanks in advance !

  • Hello Anonymous 

     

    I have used the following sample data:

     

     

    And created following measures:

     

    Total Value = SUM('Table'[Value])
     
    % Cat A =
    VAR _CatA = CALCULATE([Total Value],'Table'[Category] = "CAT A")
    VAR _Overall = CALCULATE([Total Value],REMOVEFILTERS('Table'[Category]))
    RETURN
    DIVIDE(_CatA,_Overall)
     
    Result:
     

     

    Hope this helps

2 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Create the following measures for the matrix:

     

    Sum Valeur = SUM(FactTable[Valeur])
    % Drying Direct =
    VAR Direct =
        CALCULATE (
            [Sum Valeur],
            FILTER ( FactTable, FactTable[Category] = "Drying Direct" )
        )
    RETURN
        IF (
            ISINSCOPE ( FactTable[Country] ),
            BLANK (),
            DIVIDE ( Direct, [Sum Valeur] )
        )
    

     

    Create the matrix with the Year in rows, the country in columns and add both measures. Then do the following:

     

  • vivran22's avatar
    vivran22
    Community Champion

    Hello Anonymous 

     

    I have used the following sample data:

     

     

    And created following measures:

     

    Total Value = SUM('Table'[Value])
     
    % Cat A =
    VAR _CatA = CALCULATE([Total Value],'Table'[Category] = "CAT A")
    VAR _Overall = CALCULATE([Total Value],REMOVEFILTERS('Table'[Category]))
    RETURN
    DIVIDE(_CatA,_Overall)
     
    Result:
     

     

    Hope this helps