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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How can i get totals in tables as i need them?

Hi to everyone here,

 

I'm new to Power BI Desktop and i've created a quick measure to know each cost per workplace and the total sum of all workplace costs. 

Captura.JPG                         PBIX file here

The first part works great, but on last row ("Total") instead of a sum of all workplace costs, seems like it took the sum of all unitary cost per workplace and then multiply that value by the total quantity.

 

I replicate the data and structure on a dummy and the error persists. Have anyone had a similar problem?

 

I would really appreciate any advice on how to show data right.

 

Thanks in andavce,

Pere Joan

 

 

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I could not open the link, because it asked to enter the password.

However, please try to write the below measure and put it into the visualization.

 

Costs Total = Sumx (Table Name, [Quantity Column] * [Cost Column])

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

Hi, @Anonymous 

Thank you for your feedback and for sharing the sample pbix file.

After seeing the relationships between tables, please try to write the below measure and put it into the visualization.

 

UnitaryCost X quantity V2 =
SUMX (
TimeLineQuantity,
TimeLineQuantity[quantity]
* LOOKUPVALUE (
OFs[UnitaryCost],
OFs[manufacturingReference], RELATED ( manufacturingReference[manufacturingReference] ),
OFs[workplace], RELATED ( workplace[workplace] )
)
)

 

The cost is coming from a different table, and it is related to other different tables.

So, in my opinion, lookupvalue function and related function has to be used together.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

7 REPLIES 7
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I could not open the link, because it asked to enter the password.

However, please try to write the below measure and put it into the visualization.

 

Costs Total = Sumx (Table Name, [Quantity Column] * [Cost Column])

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

I'm sorry!
It should work now, i forgot to select no restrictions in Google drive.

https://drive.google.com/file/d/1JQ4JXyZE2xrjR4DwPxNYRcQwsx5RkbEF/view?usp=sharing

 

That a good solution, but i was wondering if it's a way to get the totals right in the same table.

At least if it's possible, it would be great to know where's the limit. What operation can i do that is going to be well sumed. Even if it's none.

Hi, @Anonymous 

Thank you for your feedback and for sharing the sample pbix file.

After seeing the relationships between tables, please try to write the below measure and put it into the visualization.

 

UnitaryCost X quantity V2 =
SUMX (
TimeLineQuantity,
TimeLineQuantity[quantity]
* LOOKUPVALUE (
OFs[UnitaryCost],
OFs[manufacturingReference], RELATED ( manufacturingReference[manufacturingReference] ),
OFs[workplace], RELATED ( workplace[workplace] )
)
)

 

The cost is coming from a different table, and it is related to other different tables.

So, in my opinion, lookupvalue function and related function has to be used together.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

I have some problems with the relationships.

2.JPG

It's because of the relationships.

In the dummy the relation between TimeLineQuantity and ManifacturingOrder is "many to one", but in the Good Report is "many to many".

1 - copia.JPG

As soon as i changed in the dummy it failed like in the good one.

But, It doesn't let me change it.

1 - copia.JPG

 What can i do? 😞

 

Hi, @Anonymous 

In my pbix file, I can change it to manytomany, then I can also change it back to onetomany.

Perhaps, just close your pbix file and open it again?

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Yes, that's because i share with you the dummy.
The real one has some confidential information and its larger (f.e. 9 million rows in the TimeLineQuantity table)

 

I'm now looking if the manifacturingOrder relation differs in any aspeckt.

 

Thanks for your support @Jihwan_Kim 🙂

Anonymous
Not applicable

We fix it!

 

It was taking null cells into acount. Once I filtered them, it worked like a charm :D!

 

Thanks a lot @Jihwan_Kim !

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.