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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
RAWA96
Regular Visitor

Search data from report dynamically using parameters and not using row level security

Hi Team,

I have to create a user report below is an example of the data set.

I have to show data of only those users who logged in.

user name who logged in I can get it from the (USERNAME() // or USERPRINCIPALNAME()) function.

Not getting how to filter data from the dataset dynamically. I don't want to use row-level security.

it's fine that the user can view all the data from the dataset if he wants but first-time users should see their own data.

Not getting any response just checking is it possible or not in Power BI desktop?

 

1 . Full Dataset

 

ID

Name

Email

Sales

1

Alex

Alexabc.com

1000

2

Jack

Jackabc.com

2000

3

Alex

Alexabc.com

200

4

Chris

Chrisabc.com

300

 

2. When Alex logs in he should see data like 

ID

Name

Email

Sales

1

Alex

Alexabc.com

1000

3

Alex

Alexabc.com

200

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

Hi @RAWA96 ,

There is no native function to get the username in Power Query. 

 

But based on the description since users have the option to view their own and all data, you may choose to consider using Enter tables and measure to filter reports.

vcgaomsft_1-1682387836872.png

Measure = 
IF (
    SELECTEDVALUE ( 'Table 2'[Data] ) = "All data",
    1,
    IF ( SELECTEDVALUE ( 'Table'[Email] ) = USERPRINCIPALNAME (), 1 )
)

vcgaomsft_0-1682387800524.png

vcgaomsft_2-1682387912016.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @RAWA96 ,

There is no native function to get the username in Power Query. 

 

But based on the description since users have the option to view their own and all data, you may choose to consider using Enter tables and measure to filter reports.

vcgaomsft_1-1682387836872.png

Measure = 
IF (
    SELECTEDVALUE ( 'Table 2'[Data] ) = "All data",
    1,
    IF ( SELECTEDVALUE ( 'Table'[Email] ) = USERPRINCIPALNAME (), 1 )
)

vcgaomsft_0-1682387800524.png

vcgaomsft_2-1682387912016.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Thanks, Gao! It worked.

 

I have one more question I have to show the sum of Sales total in Cards and it should also filter according to user login, how can I do that?

I tried but I am able to see the full values.

also, can we filter data on the basis of multiple columns like if I have two columns as email id one for supervisor and one for employee?  

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors