Forum Discussion
Split a string of values into Columns
- Anonymous3 years ago
Hi Tamerj,
i have created a measure same as mentioned. I assume that it returns the table but somehow i am not able to see any thing. Do i need to create any table prior to this?
RLS_Key =VAR String = "P1,P2,P3" -- place your sting hereVAR Items =SUBSTITUTE ( String, ",", "|" )VAR Length =COALESCE ( PATHLENGTH ( Items ), 1 )VAR T1 =GENERATESERIES ( 1, Length, 1 )RETURNSELECTCOLUMNS (T1,"Project",PATHITEM(Items,[Value]))Could you please clarify.
Hi Anonymous
please provide one clear example of what are you trying to achieve.
- Anonymous3 years agoNot applicable
Hi Tamerj1, Thanks for responding. I am using Embeding Power BI. In that we are using RLS. In general secenarios, RLS works based on Username(), Userprincipalname() where it will return either user name or user email id. With embeded power BI RLS scenario, we can get any value in the username() as part of the requirement on which value we should filter the data. As part of RLS, i am getting a string with list of values where user can see the report only with list of values corresponding data. Here string contains "Program1,Program2,Program3.." like so on. I should able to read this string and filter the data for those program related data. As i get the list of values in the form of string i need to store this as a list or column and then only can filter.
- tamerj13 years ago
Community Champion
Anonymous
I don't fully understand but you may create a table using the following DAX
List =
VAR String = "P1,P2,P3" -- place your sting here
VAR Items =
SUBSTITUTE ( String, ",", "|" )
VAR Length =
COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T1 =
GENERATESERIES ( 1, Length, 1 )
RETURN
SELECTCOLUMNS ( T1, "Project", PATHITEM ( Items, [Value] ) )- Anonymous3 years agoNot applicable
Hi Tamerj,
i have created a measure same as mentioned. I assume that it returns the table but somehow i am not able to see any thing. Do i need to create any table prior to this?
RLS_Key =VAR String = "P1,P2,P3" -- place your sting hereVAR Items =SUBSTITUTE ( String, ",", "|" )VAR Length =COALESCE ( PATHLENGTH ( Items ), 1 )VAR T1 =GENERATESERIES ( 1, Length, 1 )RETURNSELECTCOLUMNS (T1,"Project",PATHITEM(Items,[Value]))Could you please clarify.