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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
I have a scenario where I have two table.
Table A: Users and Access field
Table B: Users and AuthVariable
Now the logic is , for the user in Table B, look for the "AuthVariable" value. If the value is "Z1" , then look for the "Access" field in Table A and assign the user with all the "Access" values which start with "1"(eg: 11,15 form Table A).
If the value is "Zall", assign all the "Access" values to that user (eg: 11,28,15,55,63,64,41,36), and if the value is "Z5", assign all the "Access" values from Table A which starts with 5(55) against that user.
These values can be appended to Table A or create a new table Table C.
Could you please help with a approach.
Thanks
Poojitha
Solved! Go to Solution.
Thanks @Anonymous , this was fun.
TableC =
VAR __AccessCodes = DISTINCT('TableA'[Access])
VAR __TableB = 'TableB'
VAR __TableA = 'TableA'
VAR __Table = GENERATE(FILTER(__TableB,[AuthVariable]<>"Zall"),__AccessCodes)
VAR __TableZall = GENERATE(FILTER(__TableB,[AuthVariable]=="Zall"),__AccessCodes)
VAR __TableZallFinal = SELECTCOLUMNS(__TableZall,"User",[User],"Access",[Access])
VAR __TableFinal =
SELECTCOLUMNS(
FILTER(
ADDCOLUMNS(
__Table,
"__AuthVariable",RIGHT([AuthVariable],1),
"__Access",LEFT([Access],1)
),
[__Access] = [__AuthVariable]
),
"User",[User],
"Access",[Access]
)
RETURN
UNION(__TableA, __TableFinal, __TableZallFinal)
Thanks @Anonymous , this was fun.
TableC =
VAR __AccessCodes = DISTINCT('TableA'[Access])
VAR __TableB = 'TableB'
VAR __TableA = 'TableA'
VAR __Table = GENERATE(FILTER(__TableB,[AuthVariable]<>"Zall"),__AccessCodes)
VAR __TableZall = GENERATE(FILTER(__TableB,[AuthVariable]=="Zall"),__AccessCodes)
VAR __TableZallFinal = SELECTCOLUMNS(__TableZall,"User",[User],"Access",[Access])
VAR __TableFinal =
SELECTCOLUMNS(
FILTER(
ADDCOLUMNS(
__Table,
"__AuthVariable",RIGHT([AuthVariable],1),
"__Access",LEFT([Access],1)
),
[__Access] = [__AuthVariable]
),
"User",[User],
"Access",[Access]
)
RETURN
UNION(__TableA, __TableFinal, __TableZallFinal)
Thank you for the quick response. I will try to implement the same and update the results here.
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!