Forum Discussion

dream36876's avatar
dream36876
Frequent Visitor
1 year ago
Solved

Subtotal in Matrix Question

Hi Experts,

 

I have a matrix calculating warehouse ending inventory.

The question is, I can't display "Ending Cost" this columns's total calculation the way I want.

 

I'm using 

AVERAGE('Ending Per unit'[Cost per Unit]) * SUM('Ending Inventory'[Inventory])
 
but...
The total calculation method is not what I want.
I've tried using SUMX, but it's still not giving me the result I want.

 

I'm not sure if what I provided is clear. I would appreciate any help.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi dream36876 ,
    You can try this

    Ending_Cost = 
    VAR _t = 
    SUMMARIZE(
        'Table',
        'Table'[Cost per Unit],
        'Table'[Inventory],
        "Sum", SELECTEDVALUE('Table'[Cost per Unit])*SELECTEDVALUE('Table'[Inventory])
    )
    RETURN
    SUMX(_t,[Sum])

    Fainal output

     

    Best regards,
    Albert He


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     



3 Replies

  • dharmendars007's avatar
    dharmendars007
    Memorable Member

    Hello dream36876 

     

    Please try with the below formula..if doesnt work please share us the sample dataset to check further.

    Measure = Sumx(Values(GdsNa), AVERAGE('Ending Per unit'[Cost per Unit]) * SUM('Ending Inventory'[Inventory]))

    If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

     

    Thank You

    Dharmendar S

    LinkedIN 

    • dream36876's avatar
      dream36876
      Frequent Visitor

      Hello, Thanks for reply 

       

      But it still doesn't work what i want

      I can't share file here,how about sample data?

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi dream36876 ,
        You can try this

        Ending_Cost = 
        VAR _t = 
        SUMMARIZE(
            'Table',
            'Table'[Cost per Unit],
            'Table'[Inventory],
            "Sum", SELECTEDVALUE('Table'[Cost per Unit])*SELECTEDVALUE('Table'[Inventory])
        )
        RETURN
        SUMX(_t,[Sum])

        Fainal output

         

        Best regards,
        Albert He


        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly