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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
levialae
Frequent Visitor

Measure with two different columns

Hi

 

I am trying to calculate how the energy use per ton of production. The energy use per day is in a different table than the production per day.

When I try to use the related function it get the infinite / NaN error. I am not sure how to solve this.

Energy

 

And production

 

 

 

1 ACCEPTED SOLUTION

@levialae 

Yes, that's kind of sample data. However, you can simplify that and not the screenshot. It's very hard for us to create the solution based on the screenshot. You can just paste some data in the reply. At last, pls let us know what the result you want to get based on the data you provided.

i just created some simple data and provide a solution. pls see the attachment and check if this is what you want.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

15 REPLIES 15
selimovd
Super User
Super User

Hey @levialae ,

 

can you show the relationship?

Otherwise you should also be able to calculate that with the CALCULATE function and some modification of the filter context. What exactly do you need?

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hi Denis

 

I have attached a screenshot of the relationship.

levialae_1-1629712046064.png

The relationship is between the two 'daily' columns. I have also tried the two 'DateTime' columns which I didn't change anything for me.

 

So what I need is:

The oil use daily divided by the daily tons produced (kiln 1 scale). This will give me how much oil did we use per ton of production. 

 

 

@levialae 

The relationship is many to many. You need to clean up the data and make it to be one to many or many to one.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi again Ryan

 

It might be a stupid question, but how would I go about cleaning up date data? 

 

@levialae 

I think you need to check

1. if there is any blank value for FQN

2. what's the reason caused many to many relationship? Is it correct that you can have values that does not exists in the other table?

at last i think you need a DIM table

Table 2 = DISTINCT(UNION(DISTINCT('Table'[FQN]),DISTINCT('Table (2)'[FQN])))
use this table and create one to many relationships with the current two tables.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan

 

There are no blank values for FQN. 

I believe the reason is that I have tried to make a relationship between the two tables, and the DateTime are often not the same, i.e.:

  • 24 August 2021 10:04 for one table and
  • 24 August 2021 10:01 for the other one

Can I ask (so I understand the process) why you want to create a relationship between the names (FQN)? Is that how you would normally do something like this?

 

@levialae 

sry ,my mistake. If the time is not important for you . try to move the time and only keep the date and create relationship again.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu 

The time is actually quite important since the data will be visualized during the day for operators. However, the data will also be presented weekly - so I guess I can make a copy of the date table and remove the time and only keep dates, then use that date column instead of DateTime column?

@levialae 

you can also separte the datetime to date and time columns.

However, i think you still need a calendar table





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan

 

I have taken some time to look into this calendar table. I have implemented one now - but I'm still not sure how to divide the two figures with each other. I don't have a direct relationship between the two tables, but they are both connected to the calendar table. 

@levialae 

i think calendar table can bring out the corresponding data from both tables. could you pls provide some sample data on this?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu 

I'm not sure if this is what you mean by sample: 

I want to divide this value by the value in the table below. They are both connected to a calendar table with a many-to-one relationship.

 

levialae_1-1631008729881.png

 

levialae_0-1631008681305.png

 

 

@levialae 

Yes, that's kind of sample data. However, you can simplify that and not the screenshot. It's very hard for us to create the solution based on the screenshot. You can just paste some data in the reply. At last, pls let us know what the result you want to get based on the data you provided.

i just created some simple data and provide a solution. pls see the attachment and check if this is what you want.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu 

 

I got it now, thanks! The issue was the I was using the date from the oil consumption instead of my calendar table - not very clever of me!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors