Forum Discussion
filter on a page usign USERNAME()?
- 3 years ago
That's correct, you cannot use the USERNAME or USERPRINCIPALNAME functions as a column in a table. However, you can use these functions in a measure to filter the data at the visual level. Here's how you can do this:
- Create a new measure using the USERNAME or USERPRINCIPALNAME function. For example:LoggedInUser = USERNAME()
Add the measure to the table or matrix visual that you want to filter.
Click on the visual and go to the "Format" tab in the top menu.
In the "Filters" section, click on the "Add" button.
In the "Add filter" window, select the measure that you created as the field to filter by.
In the "Filter type" dropdown, select "Advanced".
In the "Advanced Filter" window, select the operator and value for your filter. For example, you can use the "=LoggedInUser" measure to filter the data for the logged in user.
Click "OK" to apply the filter.
I hope this helps! Let me know if you have any questions.
- Create a new measure using the USERNAME or USERPRINCIPALNAME function. For example:
In Power BI, you can create a page level filter by using a report-level filter or a page-level filter.
To create a report-level filter, follow these steps:
- Click on the "File" tab in the top menu and select "Options and settings".
- In the Options and settings window, select "Filters".
- In the Filters window, click on the "New" button.
- In the "New filter" window, give your filter a name and select the field that you want to use as the filter.
- In the "Filter type" dropdown, select "Advanced".
- In the "Advanced Filter" window, select the operator and value for your filter. For example, you can use the "=Username()" function to filter the data for the logged in user.
- Click "OK" to apply the filter.
To create a page-level filter, follow these steps:
- Go to the page that you want to add the filter to.
- Click on the "Format" tab in the top menu and select "Page level filters".
- In the "Page level filters" window, click on the "Add" button.
- In the "Add filter" window, give your filter a name and select the field that you want to use as the filter.
- In the "Filter type" dropdown, select "Advanced".
- In the "Advanced Filter" window, select the operator and value for your filter. For example, you can use the "=Username()" function to filter the data for the logged in user.
- Click "OK" to apply the filter.
I hope this helps! Let me know if you have any questions.