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
ElHeatho
Frequent Visitor

Measure to return other measure's value via lookup table

Hi there, 

 

I am building a Power BI model that estimates the demand and supply of water for a number of industrial sites. Water is transfered between some of the sites. 

 

I have information feeding into the Power BI that helps to estimate the water that is being supplied from one site to another and have successfully built a measure that returns the right number for each site that has a water supply from another site. 

 

What I want to do is write a measure that represents the 'demand' for water from the site that is sending it to the site that has this water as part of its supply. The below might help to explain:

Site with a 'demand' to supply water to another site Site with a 'supply' from another site  
Site A>>>>>Site CE.g. Site A is sending water to Site C
Site B>>>>>Site DE.g. Site B is sending water to Site D

 

So currently I have a measure that returns:

SiteExternal Supply
A5L
B10L
C0L
D0L

 

I want to write a measure that uses the lookup table below:

Supply SiteDemand Site
Anull
Bnull
CA
DB

 

To return the following:

SiteExternal Demand
A0L
B0L
C5L
D10L

 

I hope that makes sense. Appreciate any help you might be able to give!

9 REPLIES 9
Anonymous
Not applicable

Why would you not simplify this like so:

https://1drv.ms/u/s!ApyQEauTSLtOgYM4uGO8Etv6kSiLYQ?e=J9qX8q

Best
D

Thanks for the idea @Anonymous !

 

Unfortunately my situation is a little more complext than that. The 'volumes' of water in the Power BI file you attached are actually rates of water that are multiplied with a base table that has a production qty over time for each site. E.g.:

 

SiteYearProduction
1202010
1202112
1202214
2202010
220218
2202212
.........

 

Once I introduce this 'baseline' table into your solution I cannot make a relationship between all four tables. Do you have any ideas on how to get around this? 

 

Thanks again!

Anonymous
Not applicable

Bear with me...

Best
D
Anonymous
Not applicable

OK. Use the same link as above. I've updated the file. Not sure if I understood correctly how the base table is connected to sites but you definitely will see how things like this are done properly.

Any other questions - just ask.

Best
D

Thanks @Anonymous .

 

The way you have set it up makes sense and is nice and clean and I can get it to work on my model using the 'demand site ID' and 'supply site ID' fields. However, what if I want to report the output from a single 'site' field rather than having the 'supplying site ID' and 'demanding site ID' fields? 

 

I currently have a number of other measures that calculate different types of demand for each site and the dashboard is set up to be filtered by each 'site' rather than a 'supply site' vs. a 'demand site'.

 

For example assuming there is only one year of data and the only case of external water transfer is Site 1 transfering 2L per qty of it's own production to Site 5, I'm looking to be able to produce the following output:

SiteQtyExternal Supply RateExternal SupplyExternal Demand RateExternal Demand
11022000
2100000
320000
4100000
5000210
600000
700000
800000

 

Thanks again!

Anonymous
Not applicable

Check the file again. But check the model thoroughly with some other data.

Best
D

Thanks again @Anonymous .

 

I was able to get this to work however, there is one more complication I couldn't get around. 

 

Using the model you uploaded, I have a 'site' lookup table that contains some information about each site (long, lat, and some other groupings). This is then linked to the 'Production Qty' table which is actually at a lower level of detail than 'Site'. This by itself isn't a problem in getting your solution to work however, the issue is I am reporting everything (there are a number of other measures) from the 'site' lookup.

 

Using your Power BI as an example, I've tried to make some modifications to get the table on the 'Page 2' tab to produce the same results by using the 'suppling site ID' field rather than the 'site' field. Hopefully the picture below helps to explain.

 

I apologise I should have been more thorough in my original explanation...

 

 

Capture.PNG

Anonymous
Not applicable

Hi there. @ElHeatho, we will be going round and round with this. You'd have to give me your model and (fake) data. I can't see how it could all be resolved without this.

Best
D

Hi @Anonymous ,

 

This link should include an example of the model I am using - including the work you have done above. 

 

https://drive.google.com/drive/folders/15-VCHgQOfmEr8tSkxMrUtaAUqU5jPueO?usp=sharing

 

Appreciate any thoughts you may have. 

 

Thanks!

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.

Top Solution Authors