Forum Discussion
Ratio Calculation
- 2 years ago
You don't need a data model for this but, if you have a model, still this formula will work. Here is the DAX measure that you can use:
Ratio = VAR _clientTotal = CALCULATE ( SUM ( MainTable[Amount] ), FILTER ( ALL ( MainTable ), MainTable[ClientID] = SELECTEDVALUE ( MainTable[ClientID] ) ) ) VAR _ratio = DIVIDE ( SUM ( MainTable[Amount] ), _clientTotal ) RETURN _ratioWell instead of SUM ( MainTable[Amount] ) you can create a simple measure like this and use it too:
Total Amount = SUM ( MainTable[Amount] )Here is the screenshot of the solution:
Hope this will resolve your issue.
Best Regards,
Udit
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
✨ Visit My Linktree: LinkTree
Thanks for taking a look and the question.
Yes the MainTable does hold all three columns. ClientID, SubAccount and Amount. Here's a sample of the data.
| ClientID | SubAccount | Amount |
| 231RQ1 | 231RQ2B1 | 17785 |
| 231YHP | 231YHET2 | 185966.1 |
| 231YHP | 231YHET3 | 132062 |
You don't need a data model for this but, if you have a model, still this formula will work. Here is the DAX measure that you can use:
Ratio =
VAR _clientTotal =
CALCULATE (
SUM ( MainTable[Amount] ),
FILTER (
ALL ( MainTable ),
MainTable[ClientID] = SELECTEDVALUE ( MainTable[ClientID] )
)
)
VAR _ratio =
DIVIDE ( SUM ( MainTable[Amount] ), _clientTotal )
RETURN
_ratio
Well instead of SUM ( MainTable[Amount] ) you can create a simple measure like this and use it too:
Total Amount = SUM ( MainTable[Amount] )
Here is the screenshot of the solution:
Hope this will resolve your issue.
Best Regards,
Udit
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
✨ Visit My Linktree: LinkTree