Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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:
Person | Rate | Value | Location | percent Change |
A | 0 | 5 | UN | 5/5=1 |
A | 1 | 6 | UN | 6/5=1.2 |
A | 2 | 4 | UN | 4/5=0.8 |
A | 0 | 6 | VD | 6/6=1 |
A | 1 | 7 | VD | 7/6=1.2 |
A | 2 | 5 | VD | 5/6=0/8 |
Solved! Go to Solution.
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
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
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
Got it, adding another column to allexcept.
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.
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
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
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.
Person | Rate | Value | Location |
A | 0 | 5 | UN |
A | 1 | 6 | UN |
A | 2 | 4 | UN |
A | 0 | 6 | VD |
A | 1 | 7 | VD |
A | 2 | 5 | VD |
A | 0 | 8 | UN |
A | 1 | 5 | UN |
A | 2 | 6 | UN |
A | 0 | 7 | VD |
A | 1 | 8 | VD |
A | 2 | 9 | VD |
B | 0 | 8 | UN |
B | 1 | 7 | UN |
B | 2 | 5 | UN |
B | 0 | 9 | VD |
B | 1 | 8 | VD |
B | 2 | 7 | VD |
B | 0 | 4 | UN |
B | 1 | 5 | UN |
B | 2 | 2 | UN |
B | 0 | 8 | VD |
B | 1 | 6 | VD |
B | 2 | 8 | VD |
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
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
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
10 | |
10 | |
9 | |
7 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |