Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a measure that evaluates some selections to get a rate table, possibly like the following
sel:= switch(selectedvalue(whatif[column], 0), 1, "v1", 2, "v2", "v3")
and a table of various numbers
| code | v1 | v2 | v3 |
| abc | 1 | 11 | 5 |
| def | 2 | 4 | 16 |
and i'd like to retrieve the value, as if this was valid
abc:= lookupvalue(table[<sel>], table[code], "abc")
Is there a clean way to do this? Avoiding decision blocks like
abc:= switch(sel,
"v1", lookupvalue(table[v1], table[code], "abc"),
"v2", lookupvalue(table[v2], table[code], "abc"),
lookupvalue(table[v3], table[code], "abc")
)
This is cleaner, but still a hack and not sustainable
abc=
var vt1 = SELECTCOLUMNS( FILTER( table, [code] = "abc" ), "col", SWITCH( [sel], "v1", [v1], "v2", [v2], [v3] ) )
return FIRSTNONBLANK( vt1, 1 )
@hansei Honestly, I'm not even sure what exactly you are trying to do or what the expected outcome is that you want but pretty sure that you can't take a text string and suddenly treat it as a column name.
I think the main problem you are having is that you need to unpivot your v1, v2, v3 columns.
The general LOOKUPVALUE equivalent is MAXX(FILTER(...)...) but you still can't magically transform text into something that can be used as a column reference.
Agreed, unpivoting is the easy way to go.
And I didn't think the desire to reference a column dynamically was considered 'magical'. Just like one might use Record.Field(var, "abc") instead of var[abc] in M when the field name was dynamic.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 19 | |
| 17 | |
| 11 |