Forum Discussion
Add total to each record by category
Good morning!
I'm trying to add a column in a table to show the summation of a value by category. I've managed to get the result but he always adds it to me as a "summary." What I would like would be for the value "TotalxCategory" to be the numeric value only and to add it in each record. I add image because an image is worth a thousand words 😛
Any idea how I can do it?
Thank you very much in advance.
You can also try measuring how to:
TOTALCategory = CALCULATE( SUM('Table'[Value]), FILTER( ALL('Table'), 'Table'[Category]=MAX('Table'[Category]) ) )Here's the output:
Here's the demo, please try it out: Add the total to each record by category
Best regards
Link
If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
4 Replies
- v-xulin-mstf
Community Support
You can also try measuring how to:
TOTALCategory = CALCULATE( SUM('Table'[Value]), FILTER( ALL('Table'), 'Table'[Category]=MAX('Table'[Category]) ) )Here's the output:
Here's the demo, please try it out: Add the total to each record by category
Best regards
Link
If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
- Syndicate_Admin
Administrator
Thanks a lot!
- AllisonKennedy
Community Champion
You can do this using DAX filters, for example try a new Measure:
TotalxCategoria =
VAR _Cat = SELECTEDVALUE(Table[Categoria])
RETURN
SUMX(FILTER(Table, Table[Categoria] = _Cat), Table[Valor])- Syndicate_Admin
Administrator
Thank you very much for your response.
This solution does not just work as it adds up the total of each value. For example in field A sum A - 20 and A -100