Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Not sure of the best way to describe the problem or even how to approach solving this but let me try my best.
I'm using LOOKUPVALUE to pull a value based on two columns: [Defect] and [Location] which gives me a numerical value. This works fine, but I only have data for around 80% of the data. i.e. the defect location may have 50 total values but I've only collected data for 10.
This is how the formula looks like:
This is the table I'm pulling the lookup value from:
What I'm trying to achieve is if the lookup value meets the first requirement of the "Defect Name" column, but not the "Defect Location" column, it automatically defaults to using the "Defect Location" value of other.
For example, I'm looking to pull up a value of
[defect]"Open Lamination" and [Locaion]"Yoke".
Since there is no value for this in my lookuptable, I want it to automatically refer to using the value listed in
[defect]"Open Lamination" and [Location]"Other"
If it helps, this value is just an average of the values listed for that particular defect. Let me know if I've explained that well but not sure which functions I would even use to approach this type of problem. Let me know if there's anything I need to give clarification on that make it easier to support me.
Thank you:)
Solved! Go to Solution.
You can try to add a conditional 'location' variable in your calculated column.
Something along the lines of...
Average =
var _location =
IF(
ISBLANK(
LOOKUPVALUE('Table A'[Location], 'Table A'[Name], 'Table B'[Name], 'Table A'[Location], 'Table B'[Location])
),
"Other",
[Location]
)
Return
LOOKUPVALUE(
'Table A'[Avg],
'Table A'[Name], 'Table B'[Name],
'Table A'[Location], _location
)
Basically you are performing the lookup twice. The first time to see if the location returns a blank. The second time returns the rework time using 'Other' if needed.
Proud to be a Super User! | |
You can try to add a conditional 'location' variable in your calculated column.
Something along the lines of...
Average =
var _location =
IF(
ISBLANK(
LOOKUPVALUE('Table A'[Location], 'Table A'[Name], 'Table B'[Name], 'Table A'[Location], 'Table B'[Location])
),
"Other",
[Location]
)
Return
LOOKUPVALUE(
'Table A'[Avg],
'Table A'[Name], 'Table B'[Name],
'Table A'[Location], _location
)
Basically you are performing the lookup twice. The first time to see if the location returns a blank. The second time returns the rework time using 'Other' if needed.
Proud to be a Super User! | |
Never mind! I see where my mistake was, you were just shortening some of the variables I had given you and the variables from the two tables were differing in my formula.
This solution worked quite well for what I needed it for. Thank you!
Thanks for the quick response. Could you elaborate a little further on a couple of points:
1.
Average =
var _location =
Where is this coming from?
2. IS Table A the table that I'm trying to perform the lookupvalue from and Table B the table that I have the calculated column in? Or vice-versa.
3.
'Table A'[Avg],
Is this coming from the "Average" value that was just calculated in the introduced _location variable?
Just for clarity for me: Can you refer to the table being looked up as "Table Lookup" and the table which the calculated column is being put into as "QC Database".
Thanks again!
User | Count |
---|---|
73 | |
70 | |
38 | |
25 | |
23 |
User | Count |
---|---|
96 | |
93 | |
50 | |
43 | |
42 |