Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DAX HELP

I want to calculate sum of quantity from Table A, if the records are aviable in Table B.

Please help on this

 

  • Hi, Anonymous 

     

    I am unable to access the link. For further information, please show us a valid link. So I create data to reproduce your scenario.

    TableA:

    TableB:

     

    There is a many-to-one relationship between two tables.

     

    You may create a measure as follows.

     

    SumQuantity = 
    var _result = 
    SUMX(
        RELATEDTABLE(TableB),
        TableB[Quantity]
       ) 
    return
    IF(
       _result= 0,
       0,
       _result
    
    )

     

     

    Result:

     

    Best Regards

    Allan

     

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

     

     

     

     

5 Replies

  • az38's avatar
    az38
    Community Champion

    Anonymous 

    to correct answer show data sample from both of your tables and point to summarized field

     

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, Anonymous 

     

    I am unable to access the link. For further information, please show us a valid link. So I create data to reproduce your scenario.

    TableA:

    TableB:

     

    There is a many-to-one relationship between two tables.

     

    You may create a measure as follows.

     

    SumQuantity = 
    var _result = 
    SUMX(
        RELATEDTABLE(TableB),
        TableB[Quantity]
       ) 
    return
    IF(
       _result= 0,
       0,
       _result
    
    )

     

     

    Result:

     

    Best Regards

    Allan

     

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

     

     

     

     

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, Anonymous 

     

    If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

     

    Best Regards

    Allan