Forum Discussion

ms92ita's avatar
ms92ita
Helper I
4 years ago
Solved

Generate filters for a report from c# API based on user

Hi,   I am generating some reports with Azure SQL Direcy Query mode that I will use in my application with the power bi javascript visuals (already implemented). Now, for some reports I need to pre...
  • Anonymous's avatar
    Anonymous
    4 years ago

    HI ms92ita,

    I think RLS based on username should be more suitable for your requirements.
    You only need to create a mapping table with username and recorders and link to other table records and assign roles on the power bi service side. (it can be assigned to a group)

    Then these filter effects will be dynamically applied to your dataset when the report data is loaded.

    Solved: RLS with UserName() - Microsoft Power BI Community

    In addition, if you do not want to add a detailed user mapping table to your data source, you also need to compare user mapping in your code.
    You can add a tag field to your table field, then use the if statement in your code to compare the current username and default user list to return the tag and manually apply the filter effect based on the result.

    Regards,

    Xiaoxin Sheng