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
rmacy
New Member

Multiple Lookup Column Math

Hi,

 

I was hoping to get some help with some data we are trying to plot in PowerBI. We have a table of data similar to what is shown below. At Time = 0 we know that the value in the mass column is the initial mass of our samples. We want to create a mass loss column so that we can plot mass loss vs. time for each sample. This would mean each new sample would start with a mass loss of 0 and then go up by the difference.

 

Is there a single function that can do this, or will this require the use of an intial mass column followed by a total mass loss column? In both cases, what would be the best way to go about doing this?

 

SampleTime (s)Mass (g)
1010
1309.9
1609.8
11209.7
11809.5
2015
21514.9
26014.7
212014.5

 

Thanks in advance!

4 REPLIES 4
parry2k
Super User
Super User

@Fowmy with that assumption it is fine but if there ever a case it can go on the higher side, logic will fail, to be on the safer side, if I have to solve for it, I will use initial value based on time (s) = 0 and then it doesn't matter if value depletes or increase over time. Just my 2 cents.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Fowmy great solution but see one drawback if initial mass where time(s) = 0 is smaller than other mass (g) values for the same sample, your calculation will not work, it will take the maximum value of that sample not the initial time (s) = 0 value, and I think that is one of the requirement, always look at the initial value.

 

Just my 2 cents. I could be totally wrong here.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k 

Thanks for the observation, I assumed the initial mass keeps depleting as time passes. 


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Fowmy
Super User
Super User

@rmacy 

I am not sure if you need the accumulated mass difference or individual difference. Below column shows the cumulative:

 

 

Mass Loss = 
var __currsample = Table7[Sample]
var __currmass = Table7[Mass (g)]
var __inimass =
    MAXX( FILTER( Table7 , Table7[Sample] = __currsample &&   Table7[Time (s)] = 0), Table7[Mass (g)] )
return
    __inimass - __currmass

 

 

Fowmy_0-1622061338793.png

If you are interested in the individual difference, take the one below:

 

Mass Loss Indv = 
    var __currsample = Table7[Sample]
    var __currmass = Table7[Mass (g)]
    var __currtime = Table7[Time (s)]
    var __prevtime =
        MAXX( FILTER( Table7 , Table7[Sample] = __currsample && Table7[Time (s)] < __currtime), Table7[Time (s)] )
    var __premas =
        MAXX( FILTER( Table7 , Table7[Sample] = __currsample && Table7[Time (s)] = __prevtime), Table7[Mass (g)] )
    return
      __premas - __currmass 

 

Fowmy_0-1622062620398.png

 

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.