Forum Discussion

brinky's avatar
brinky
Icon for Helper IV rankHelper IV
4 years ago
Solved

Get volume (multiplication)

Hello,

I'm trying to get the volume sales as follow however I'm getting the wrong values.

I'm using measure 2 to get the sales qty then I'm using measure 4 to get volume however volume values are wrong 🤔 combined sales tables and volume tables are connceted.

Any idea how I can solve such issue? I was trying to get the volume sales with measure 2 using related function but didn't manage.

 



  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi brinky ,

     

    Try this code.

     

    Measure 3 = 
    VAR _Invoiced_QTY = 
    CALCULATE(SUM(Combined_Sales[Invoiced_QTY_PU]),FILTER(Combined_Sales,Combined_Sales[Return_Reason] in {1,BLANK()}))
    VAR _Volumn = CALCULATE(SUM(Volume[Volume]),FILTER(Volume,Volume[CSB_ID_Code] = MAX(Combined_Sales[CSB_ID_Code])))
    RETURN
    _Invoiced_QTY*_Volumn

     

    Result is as below.

    Best Regards,
    Rico Zhou

     

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

6 Replies

  • bcdobbs's avatar
    bcdobbs
    Icon for Community Champion rankCommunity Champion

    Hi brinky,

    It's not clear from the detail so far how your volume table comes into play as everything just references combined sales. Are you able to share a demo pbix with your structure and some data? Alternatively some dummy data from each table?

    • brinky's avatar
      brinky
      Icon for Helper IV rankHelper IV

      Hi bcdobbs 
      Sorry loaded the wrong measure I have updeted my post.

       

      Thanks

      • bcdobbs's avatar
        bcdobbs
        Icon for Community Champion rankCommunity Champion

        Could you provide some sample data from the two tables, an image of the relationship between them and a few correct values for the calculation.

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi brinky ,

     

    I think your [Measure 4] is based on [Measure 2] and related

    I create a sample to have a test.

    CombinedSales:

    VolumTable_1:

    I created a relationship between two tables by Category.

    Measures are the same, it works well.

    Firstly, please check whether [Measure 2] is correct.  You can add a calculated column by related function to get data from [Litres] in CombinedSales.

    C_Litries = RELATED(VolumTable_1[Litres])

    Or create a measure.

    C_Litries = calculated(sum(VolumTable_1[Litres]),Filter(VolumTable_1,VolumTable_1[...] = max(CombinedSales[...])))

     And check whether [Litres]  part is correct.

     

    Best Regards,
    Rico Zhou

     

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

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi brinky ,

         

        Try this code.

         

        Measure 3 = 
        VAR _Invoiced_QTY = 
        CALCULATE(SUM(Combined_Sales[Invoiced_QTY_PU]),FILTER(Combined_Sales,Combined_Sales[Return_Reason] in {1,BLANK()}))
        VAR _Volumn = CALCULATE(SUM(Volume[Volume]),FILTER(Volume,Volume[CSB_ID_Code] = MAX(Combined_Sales[CSB_ID_Code])))
        RETURN
        _Invoiced_QTY*_Volumn

         

        Result is as below.

        Best Regards,
        Rico Zhou

         

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