Forum Discussion
Issues with repeating values and dates
Hey all, I'm dealing with an issue involving repeating values and calculating totals.
To summarize the problem, I need to get the sum of a certain value by date. In the data, there are multiple entries for each date split up between 3 smaller categories. Each entry in those categories contains the value I need to use to get the sum repeated a number of times. For example, I've put a similar table below with the same problem, for one date. For this specific example, I would want the outcome to be 12 (7+2+3). If I just grabbed the sum of the column, I would get 39 (7*3 + 2*3 + 3*4).
Date Group Value
3/11 A 7
3/11 A 7
3/11 A 7
3/11 B 2
3/11 B 2
3/11 B 2
3/11 C 3
3/11 C 3
3/11 C 3
3/11 C 3
How can I get all distinct values for the values column by date in a way that I can take the sum of those distinct values by date?
Any help would be greatly appreciated.
jarwest try this measure
Total Value = SUMX ( SUMMARIZE ( Table, Table[Date], Table[Group], "@Value", MAX ( Table[Value] ) ), [@Value] )✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
6 Replies
- parry2kSuper User
jarwest try this measure
Total Value = SUMX ( SUMMARIZE ( Table, Table[Date], Table[Group], "@Value", MAX ( Table[Value] ) ), [@Value] )✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- jarwestHelper II
I'm making sure I applied it correctly, but it does not seem to have worked. I'm getting a value that is in the thousands, when my value isn't even in the hundreds. My end goal is a table where I can display the value for each day alongside the date.
- parry2kSuper User
jarwest based on the sample data you provided and if I use the measure that I gave to you, I get the correct result, see Total Value column in the image below:
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- jarwestHelper II
How did you get the data from multiple repeating columns to summarized rows like that? My original sample data had 10 rows, your final results has 3.
- parry2kSuper User
jarwest I used a simple table visual and dropped all the columns on values, along with new measure and that's it.
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- jarwestHelper II
I found my issue. I made it as a new column instead of a new measure. This solution is working correctly, thank you!