Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.