Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Sum over one criterion

Hello all,
I have a table with various information.
I have an order. Different material numbers are assigned to this order. In my measure, the correct number is now displayed based on the smallest criterion, i.e. the material. Now I want to have a measure that shows the sum of my current measure in the rows. The new measure should aggregate my old one based on the order.

The 6,626.52 is the sum of my orders and I would like to display this in another column.

Daniel28DH_0-1679331941957.png

 



Can anyone help me?
Thanks in advance

8 REPLIES 8
Anonymous
Not applicable

Thank you for your answers.
Unfortunately, I cannot publish any data from my organisation.
Here is an excerpt from my model. It is only about one table. With all the information in the table.

Daniel28DH_0-1679417016060.png

The formulas are just aggregations over a column of my data table:
LeistBestandsverFert = calculate(sumx(Fabrikleistung,Fabrikleistung[Betrag]),Fabrikleistung[Hauptbuch]="522000")
This is what my data table looks like:

YearPeriodBelegartBookMaterialOrderValueBME
202202WE5220020201160111010525686-797,000ST
202201WA52100002010000001021052568631,210ST
202201WA521000020100011120410525686114,920ST
202201WA52100002010001113041052568625,920ST
202201WA5210000902000654602105256867,070ST
202201WA5210000902000654802105256867,140ST
202201WA521000090200065050210525686149,770ST
202201WA521000090200065060210525686145,420ST


As a result, I need a new column that does the following for all order values:
=((Value for Book "522002")  -  (Value for Book "521002"))
As a result, I have a value of 315.55 in the new column for the order.

Daniel28DH_1-1679417577174.png

 

@Ashish_Mathur @PhilipTreacy  Can you help?


Hi,

Do you want the result as 315.55 in each row of the Result column?  Also, in your measure you have referred to columns which i do not see in your data at all.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

My measure is simply an addition or subtraction of the value depending on which book is being addressed.

Daniel28DH_0-1679485719428.png

LeistBestandsverFert = calculate(sumx(Fabrikleistung,Fabrikleistung[Value]),Fabrikleistung[Book]="522000")
LeistBestandsverUnfert = calculate(sumx(Fabrikleistung,Fabrikleistung[Value]),Fabrikleistung[Book]="521000")
LeistFabrikLeistFert = calculate(sumx(Fabrikleistung,Fabrikleistung[Value]),Fabrikleistung[Book]="522002")*-1
LeistFabrikLeistunfert = calculate(sumx(Fabrikleistung,Fabrikleistung[Value]),Fabrikleistung[Book]="521002")*-1

The result should be displayed in each row of the column because it refers to the order number.

Just cannot understand your requirement.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Daniel28DH_0-1679588861930.png

With the filter Allselected, I now get the result in every row as desired. However, this only works if I also set an order in the filter. Do you have a solution how I can work around this?

Anonymous
Not applicable

Daniel28DH_0-1679575142993.png

I do not want to have the result of the factor output at the bottom of the totals column. It should be in a new column in each row.

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download example PBIX file.

 

I don't have access to your file and hence your measure, but you could use this to sum the value per order 

 

 

Measure = CALCULATE(SUM('DataTable'[Value]), FILTER(ALL('DataTable'), 'DataTable'[Order] = SELECTEDVALUE('DataTable'[Order])))

 

 

Giving this

sumval.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.