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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
chris_steins
New Member

DAX Formula

I'm looking to lookup a value in a data table and make a calculation based on it.

Below is my example table, where I'm trying to calculate the "percent Change" column where I want to look up in the table the same "Person" and same "Location" with a Rate of "0" and calculate the percent Change of "Value".  In the first row, it's simply dividing by itself since it has a rate of 0, but the next one it is taking the value (6) , and searching for the Value for the same location and Person and a Rate of 0 (Value of 5).  The final number here would then be subtracted from 1 to get the true value.

 

Any help would be appreciated, I'm struggling with the ability to lookup the value based on multiple columns and using it to calculate.

 

Example Data Table:

 

PersonRateValueLocationpercent Change
A05

UN

5/5=1
A16UN6/5=1.2
A24UN4/5=0.8
A06VD6/6=1
A17VD7/6=1.2
A25VD5/6=0/8
2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

@chris_steins 

percent Change = 
VAR num_ = Table1[Value]
VAR denom_ =
    CALCULATE (
        AVERAGE ( Table1[Value] ),
        ALLEXCEPT ( Table1, Table1[Location] ),
        Table1[Rate] = 0
    )
RETURN
      DIVIDE ( num_, denom_ ) 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

AlB
Community Champion
Community Champion

@chris_steins 

See it all at work in the attached file.

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Cheers 

 

SU18_powerbi_badge

View solution in original post

9 REPLIES 9
AlB
Community Champion
Community Champion

@chris_steins 

So is it solved now?

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

chris_steins
New Member

Got it, adding another column to allexcept.

chris_steins
New Member

Thoughts on what I need to add so that it only looks at the values coming from the same Parent?  Right now it is averaging all Parents with a Rate of 0.

AlB
Community Champion
Community Champion

@chris_steins 

See it all at work in the attached file.

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Cheers 

 

SU18_powerbi_badge

AlB
Community Champion
Community Champion

@chris_steins 

percent Change = 
VAR num_ = Table1[Value]
VAR denom_ =
    CALCULATE (
        AVERAGE ( Table1[Value] ),
        ALLEXCEPT ( Table1, Table1[Location] ),
        Table1[Rate] = 0
    )
RETURN
      DIVIDE ( num_, denom_ ) 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

chris_steins
New Member

The suggested code gives me the error of multiple values was supplied where a single value was expected.

 

Probably because of my followup where there are multiple lines that need averaged.

 

Another example table.

PersonRateValue

Location

A05UN
A16UN
A24UN
A06VD
A17VD
A25VD
A08UN
A15UN
A26UN
A07VD
A18VD
A29VD
B08UN
B17UN
B25UN
B09VD
B18VD
B27VD
B04UN
B15UN
B22UN
B08VD
B16VD
B28VD

 

AlB
Community Champion
Community Champion

@chris_steins 

See it all at work in the attached file.

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

AlB
Community Champion
Community Champion

Hi @chris_steins 

Try this for your calc column

percent Change =
VAR num_ = Table1[Value]
VAR denom_ =
    CALCULATE (
        DISTINCT ( Table1[Value] ),
        ALLEXCEPT ( Table1, Table1[Location] ),
        Table1[Rate] = 0
    )
RETURN
     ( DIVIDE ( num_, denom_ ) )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

chris_steins
New Member

One more caveat to the question, the data table will have more than 1 entry with the same Person, Rate, and Location so I want to average the "Values" to use in the equation.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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