Forum Discussion

rgoo's avatar
rgoo
Frequent Visitor
2 years ago
Solved

Custom calculation for matrix row sub total

This is my table:


and this is the matrix visual i have done:

right now the Total row is just summing up all the rows but what i want is to add my own custom Total's rows
to achieve something like this:

 

the dax calculation for the productivity 2023/24 and Var % total is: 

 

 

productivity 23 = DIVIDE('shipment 23 '[First cost 2023 ], 'headcount'[HC 23]  )
productivity 24 = DIVIDE('shipment 24 '[First cost 2024 ], 'headcount '[HC 24])

 

 

 

 

 

Var % = 
DIVIDE(
    ([productivity 2024] - [productivity 2023]),
    [productivity 2023],
    BLANK()
)

 

 

 

  • Hi rgoo ,

     

    What measure did you write?

    For  Productivity 2023, you should be writing something like:

    Productivity 23 (2) = 
    IF (
        NOT ( HASONEVALUE ( 'table'[Office column] ) ),
        [custom total measure],
        [the measure used in productivity 23 column]
    )

     

4 Replies

  • Hi rgoo

     

    try something like this:

    IF (
        NOT ( HASONEVALUE ( 'table'[Office] ) ),
        [desired total],
        [the other measure]
    )
    

     

    • rgoo's avatar
      rgoo
      Frequent Visitor

      hi, thank you for your response, i have created the measure but it is showing the total productivity for 2024 only, in a new column.

      I was wondering if it's possible to add it to the bottom of the matrix as the last row with the first column named: total followed by productivity 23 ,productivity 24 and var % value.

      somthing like this:

       

       i am using card visual to display the custom total values as of now.

      • danextian's avatar
        danextian
        Super User

        Hi rgoo ,

         

        What measure did you write?

        For  Productivity 2023, you should be writing something like:

        Productivity 23 (2) = 
        IF (
            NOT ( HASONEVALUE ( 'table'[Office column] ) ),
            [custom total measure],
            [the measure used in productivity 23 column]
        )