Forum Discussion

Khpuryear's avatar
Khpuryear
Icon for Helper I rankHelper I
1 year ago
Solved

Help with Dax: Add Two Values then Divide by a Value

Hello,

 

I'm trying to take two values, add them together, then divide by another value. I've copied an example below of the table.

LOAD NOLOAD_Total ComLOAD_Total ACC Less FSCLOAD_Total Miles
50343930502001207

 

The formula would equate to: (LOAD_Total Com + LOAD_Total ACC Less FSC) / LOAD_Total Miles

In this scenario, the desired result is: 2.69

 

On paper this should be simple, but every DAX measure I've attempted gives me an amount that doesn't make sense.

I've also provided an example image of what I'm working with below. I've highlighted the fields in question, and the table name is vw_Loads_Accessorials. 


Any help is appreciated.

Thanks

  • Hi Khpuryear,

    Can you please try below DAX expression for your requirements:
    LoadEfficiency =
    DIVIDE(
    SUM('vw_Loads_Accessorials'[LOAD_Total Com]) +
    SUM('vw_Loads_Accessorials'[LOAD_Total ACC Less FSC]),
    SUM('vw_Loads_Accessorials'[LOAD_Total Miles]),
    0
    )

    Hope the above DAX expression may help you.

    Please let me know if you have further questions.

    If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

     

    Best Regards, 

    Maruthi 

    LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

    X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

3 Replies

  • Irwan's avatar
    Irwan
    Icon for Super User rankSuper User

    hello Khpuryear 

     

    i am not sure how you consumed your table (seems you take from couple table).

    But i am assumed 2.69 is a column and come from same table.

    Measure =
    DIVIDE(
        MAX('Table'[LOAD_Total Com])+MAX('Table'[LOAD_Total ACC Less FSC]),
        MAX('Table'[LOAD_Total Miles])
    )
     

    Hope this will help.

    Thank you.

  • Hi Khpuryear,

    Can you please try below DAX expression for your requirements:
    LoadEfficiency =
    DIVIDE(
    SUM('vw_Loads_Accessorials'[LOAD_Total Com]) +
    SUM('vw_Loads_Accessorials'[LOAD_Total ACC Less FSC]),
    SUM('vw_Loads_Accessorials'[LOAD_Total Miles]),
    0
    )

    Hope the above DAX expression may help you.

    Please let me know if you have further questions.

    If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

     

    Best Regards, 

    Maruthi 

    LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

    X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

    • Khpuryear's avatar
      Khpuryear
      Icon for Helper I rankHelper I

      That worked 👍 

       

      Looks like I was pulling values from the wrong table. Also, I couldn't use SUM for LOAD_Total ACC Less FSC. It would only work when I removed it. This is a DAX measure I created before; I'm assuming that it's related to that. Either way, I think I got it.

       

      Much obliged 🍻

      Thanks