Forum Discussion
Need help in row level context in DAX
- 9 years ago
Hi mattbrice,
i pasted this:
My Health Score =
VAR all_fees =
Calculate( Sum(Remittance[Amount paid]), All(Remittance))
VAR this_factor =
SELECTEDVALUE ( Factor[Factor] )
RETURN
this_factor * all_feesand i got duplicates(couldnt attach a screenshot!), but it was definitely giving me wrong values , hence i did this:
My Health Score =
VAR all_fees =
Sum(Remittance[Amount paid])
VAR this_factor =
SELECTEDVALUE ( Factor[Factor] )
RETURN
this_factor * all_feesand got below:
Factor ClassSubclass Fee Received Modality Manager Score 0.0004 112 51000 Uniform Sunnyvale 19 0.0005 122 60000 Uniform Sunnyvale 17 0.0005 132 70000 Uniform Sunnyvale 10 0.0014 1810000 which is still not satisfying my need. i need 181000*0.0004 = 72.4 for subclass 112 and so on. thsi should be done dynamically on row level.
My current formula which is SUMX ( Factor, [Fee received] * Factor[Factor] ) is just multiplying the respective row to corresponding row, i.e 51000*0.0004 and 60000*0.0005 and so on. but i want a sum of the fee received for that particular modality and manager and multiply it by the corresponding factor of the subclass.
Regards,
Shweta
- 9 years ago
Hi All,
Thank you all for your help. Looks like my client was unclear as to what he wanted. As of now my formula is validated and looks correct , hence i am just closing this topic. Thanks again for all the help!
Regards,
Shweta
can you paste in here what the exact measure is your wrote?
At this point me (or someone else) would need to get a sample copy of your model to really help. Too many potential issues to comment back and forth.
Hi mattbrice,
i pasted this:
My Health Score =
VAR all_fees =
Calculate( Sum(Remittance[Amount paid]), All(Remittance))
VAR this_factor =
SELECTEDVALUE ( Factor[Factor] )
RETURN
this_factor * all_fees
and i got duplicates(couldnt attach a screenshot!), but it was definitely giving me wrong values , hence i did this:
My Health Score =
VAR all_fees =
Sum(Remittance[Amount paid])
VAR this_factor =
SELECTEDVALUE ( Factor[Factor] )
RETURN
this_factor * all_fees
and got below:
| Factor | ClassSubclass | Fee Received | Modality | Manager | Score |
| 0.0004 | 112 | 51000 | Uniform | Sunnyvale | 19 |
| 0.0005 | 122 | 60000 | Uniform | Sunnyvale | 17 |
| 0.0005 | 132 | 70000 | Uniform | Sunnyvale | 10 |
| 0.0014 | 1810000 |
which is still not satisfying my need. i need 181000*0.0004 = 72.4 for subclass 112 and so on. thsi should be done dynamically on row level.
My current formula which is SUMX ( Factor, [Fee received] * Factor[Factor] ) is just multiplying the respective row to corresponding row, i.e 51000*0.0004 and 60000*0.0005 and so on. but i want a sum of the fee received for that particular modality and manager and multiply it by the corresponding factor of the subclass.
Regards,
Shweta
- v-huizhn-msft9 years ago
Microsoft Employee
Hi shwets47,
It's hard to reproduce your scenario without sample table, I totally understand your data is confidential, you can create similar fake data. So that we can post solution which is close to your requirement.
Best Regards,
Angelia- shwets479 years agoFrequent Visitor
Hi All,
Thank you all for your help. Looks like my client was unclear as to what he wanted. As of now my formula is validated and looks correct , hence i am just closing this topic. Thanks again for all the help!
Regards,
Shweta