- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Avoid sum multiple times same value on column
Hi everyone,
I have being problems calculating a total on a Matrix:
I have this structure:
Batch |
IdBatch |
Amount |
Connection 1-N with Component table
Component |
IdComponent |
IdBatch |
Connected 1-N with Failure table
Failure |
IdComponent |
AmoutFailures |
Date |
So, with this information I create a view like this:
IdBatch | Date | Amount | AmountFailures | |
1 | 01/04/2024 | 100 | 2 | |
1 | 02/04/2024 | 100 | 5 | |
2 | 01/04/2024 | 300 | 2 | |
3 | 10/04/2024 | 500 | 0 | |
1 | 10/04/2024 | 100 | 10 |
But when I want to see the relation between number of failures and batch amout, I can calculate de total of failures in the right way, but I am sum more batch amout that I should do
The right result should be like this:
Batch | Year | Amount | AmoutFailures |
1 | 2024 | 100 | 17 |
2 | 2024 | 300 | 2 |
3 | 2024 | 500 | 0 |
But I am getting this result:
Batch | Year | Amount | AmoutFailures |
1 | 2024 | 300 | 17 |
2 | 2024 | 300 | 2 |
3 | 2024 | 500 | 0 |
As you can see, I am summing the batch amout 3 times.
Maybe, the way I am creating the view is wrong but I don't know how I should create it to import and work easily in Power BI.
Thank you in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @bvramilo,
Can you please try the following:
Total Batch Amount =
SUMX(
VALUES(Batch[IdBatch]),
CALCULATE(
MAX(Batch[Amount])
)
)
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much for the quickly answers, they made me think and prepare and simple example that helps to find the solution:
When I am talking about a view, I mean a database view (data from multiple tables together) and that's here where I made a mistake
My model was like that:
That's the data
So, when I go level down in the grid the behaviour was like this:
As you can see, power bi is multipling the batch amount by the number of registers so the total amout is wrong.
But, as I said before, to show you a simple model I create this one:
It works well cause Power BI knows the amout of batch is not a part of the registers.
Now I have to find how to make it work without both direction relation between Revision and Batch. I read that is not recommended
Sorry for make you waste your time and thank you so much.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You need to put the amount column in the row and failures in the value of a matrix visual. you may use date as slicer or in the row above amount in the matrix visual as well.
Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess with "view" you mean a table or matrix visual, right? assuming that you could just use the amount column from the Batch table and make sure it is not using it as an implicit measure, so:

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
02-19-2024 12:44 PM | |||
03-02-2023 12:14 PM | |||
07-01-2024 06:13 AM | |||
07-24-2024 04:56 AM | |||
05-09-2024 02:29 PM |
User | Count |
---|---|
23 | |
12 | |
10 | |
9 | |
8 |
User | Count |
---|---|
16 | |
15 | |
15 | |
12 | |
10 |