Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

How to send a list of values in CUSTOMDATA string and use it in a powerbi report (RLS/Embed token)

Hi,

I'm trying to integrate a PowerBi-report inside an Asp.net Core Web application. I generate the Embed-Token using the Microsoft.PowerBi.Api NUGET package.

I would like to filter what the user can see using a combination of username and customdata. Right now im able to sucessfully view a report with username and one value in customdata. But I would like to include several string values inside customdata eg.: "'id1','id2', 'id3'" and use the values in IN(CUSTOMDATA()). How can I do this? To generate the token I can only send in CUSTOMDATA as a string.. So how can I split CUSTOMDATA() into a list of values using DAX in the report?

Do DAX have any string.Split functionality or similar available?

Thx

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

Customdata is an information function, and I'm not so sure if it allows advanced customize. You can try to use the following formula with path function to expand a text to list:

VAR _path =
    SUBSTITUTE (
        CONCATENATEX ( VALUES ( 'Table'[Column] ), [Column], "," ),
        ",",
        "|"
    )
VAR _length =
    PATHLENGTH ( _path )
VAR _pathtable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, _length, 1 ),
        "Column", PATHITEM ( _path, [Value] )
    )

In addition, I'd like to suggest you mapping these records in your tables and use RLS to filter them.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

Customdata is an information function, and I'm not so sure if it allows advanced customize. You can try to use the following formula with path function to expand a text to list:

VAR _path =
    SUBSTITUTE (
        CONCATENATEX ( VALUES ( 'Table'[Column] ), [Column], "," ),
        ",",
        "|"
    )
VAR _length =
    PATHLENGTH ( _path )
VAR _pathtable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, _length, 1 ),
        "Column", PATHITEM ( _path, [Value] )
    )

In addition, I'd like to suggest you mapping these records in your tables and use RLS to filter them.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors