Forum Discussion
Apportionment of values based ID
Hi,
I have a table:
I would like to take the first value of ID and prorate between the same IDs using DAX. Thus:
| ID | DESCONTO | FRETE |
| 1 | 6,66 | 0 |
| 1 | 6,66 | 0 |
| 1 | 6,66 | 0 |
| 2 | 0 | 3,42 |
| 2 | 0 | 3,42 |
| 2 | 0 | 3,42 |
| 2 | 0 | 3,42 |
Thanks for your any help.
Hi credencial ,
You can create calculated columns like this:
DES = DIVIDE ( FIRSTNONBLANK ( 'Table'[DESCONTO], 1 ), CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) ) )FRE = DIVIDE ( FIRSTNONBLANK ( 'Table'[FRTE], 1 ), CALCULATE ( COUNT ( 'Table'[ID] ), FILTER ( ALL ( 'Table' ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) ) ) )Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- VahidDM
Super User
Hi credencial
Try these measures:
DESCONTO Measure = Var _MAX = max('Table'[DESCONTO]) Var _Count=COUNT('Table'[ID_VENDA]) return _MAX/_CountFRETE Measure = Var _MAX = max('Table'[FRETE]) Var _Count= COUNT('Table'[ID_VENDA]) return _Max/_CountOutput:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
- v-yingjl
Community Support
Hi credencial ,
You can create calculated columns like this:
DES = DIVIDE ( FIRSTNONBLANK ( 'Table'[DESCONTO], 1 ), CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) ) )FRE = DIVIDE ( FIRSTNONBLANK ( 'Table'[FRTE], 1 ), CALCULATE ( COUNT ( 'Table'[ID] ), FILTER ( ALL ( 'Table' ), 'Table'[ID] = EARLIER ( 'Table'[ID] ) ) ) )Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.