Forum Discussion
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 NO | LOAD_Total Com | LOAD_Total ACC Less FSC | LOAD_Total Miles |
| 503439 | 3050 | 200 | 1207 |
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
3 Replies
- Irwan
Super 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.
- maruthisp
Super User
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
- Khpuryear
Helper 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