How can I use PowerBI's Row Level Security to implement an employee filter on a website? - credentials

I have to embed a PowerBI scorecard visual on a website. I've set up the scorecard in PowerBI Desktop, and it looks fine; the slicer for the scorecard filters the employee name.
I'd like for the employee that visits the company website to see only their data in the scorecard- in other words, their presence on the website would automatically filter the scorecard to reveal their statistics only. Fortunately, they have to login to the company's website by providing their Windows credentials.
I'm not sure how to go about doing this. I understand that I have to use the "Security" portion of the "Modeling" tab, and I've (successfully) created an explicit role for one viewer by using the following code:
'Table1'[Employee Name] = "John Smith"
Of course, this only reflects John Smith's statistics when I click "View as Roles." I don't think it's practical to explicitly write a DAX code snippet for every single employee, since my company has 3000+ employees.
Can anyone share any instructions, or lead me to some?
Thank you in advance.

I had to deal with a similar issue, though we view our dashboards within the Power BI service, so that is the authentication I am familiar with. The basis for this form of dynamic row level security is that the expression written is evaluated for each row in the indicated table to either True or False.
If your user has signed in to the you will be able to determine the identity using USERPRINCIPALNAME(). This is the email address they use to sign into the service.
Since you are displaying data specific to that user, it is possible you already have their email in your data. If that is the case, and it is simply another field in your table your validation line would look something like:
'Table1'[Email] = USERPRINCIPALNAME()
The left side of the expression refers to the row you are referencing, while the right will supply the name of the authenticated user. If you don't have that available in your existing data, you could use a DAX expression to lookup the Employee name from a list of emails and their associated names.
In this case, you only have one role which everyone needs to be assigned to, and the logic above will determine which rows they can see.
This is a simple example in which each employee can only see their own data. The model can be extended by creating 'security tables' with users and their associated records, and then utilizing the CONTAINS() function to check authorization, but it sounds like you have a 1-to-1 relationship with what individuals should be able to see.

Related

MS-Access Automatically updating data based on another table (Email Blacklist)

I'm setting up a brand new database as a lot of the work we do is on multiple spreadsheets and a lot of the data is duplicated. I have a lot of knowledge with Excel, however, I feel that Access would much better suit the needs of the business and data management.
A large role for many in the business is to send emails/follow-up emails based on criteria, however, we use several services to do this and I need a new method of tracking people/businesses who have 'Opted-out' of email updates, we can export the people who opted out from the different applications and put into a spreadsheet.
I had a little play around with relationships to see if this would work, however, kept getting error along the lines of 'invalid for field type' and although I could do this with a simple countif function in Excel I was wondering if it's possible in Access without VBA.
One of the fields we have for our sponsors/delegates table is email address. I want to know if it is possible to create a new form & table or something to do the following:
User loads form, clicks a button and selects spreadsheet with emails in Column A
Data from column A is then imported into a blacklist table
Access removes duplicates and adds the rest to a blacklist table
Access updates sponsor/delegate table field 'opt-out' to yes for any email addresses added to the blacklist table
Edit: Here are 2 screenshots of the separate tables
What I need Access to do is basically tick the box 'opt-out' automatically for all records where the email matches to one in the blacklist
A query to update the opt-out field in your Sponsors table for all records which have a matching email address in the Blacklist table is relatively straightforward, with the matching operation performed by a single inner join, e.g.:
update Sponsors inner join Blacklist on Sponsors.[Email Address] = Blacklist.[Email Address]
set Sponsors.[Opt-Out] = -1

How to create a sharepoint list column that links to another list that is editable

I'm not sure if the title is a proper descriptor of what I'm trying to achieve here, hopefully it's close enough. I'm not a SharePoint expert, but I'm comfortable with creating forms and workflows as necessary to get something like this to work.
Basically, I need to have two separate SharePoint lists that are linked together, but one list needs to have row level security to hide data from other users that shouldn't see it. I need the column that is being linked to be an editable text box though, rather than a simple lookup field.
For example:
List A
Customer (text)
Description (text)
Sales People (person, multiple selections allowed)
Expenses (linked field)
List B
Customer (text)
Expenses (number)
Created by (just a reference that the sales people would actually "create" each row here)
Essentially, multiple people can be assigned to a customer in list a. The "sales people" are assigned by another user who actually creates the item for list a. I need to be able to have the people who are assigned as "sales people" to have a text box where they can enter their expenses, but on an individual basis, that would then be stored in list b with row level permissions to prevent them from seeing each others expenses totals.
List B would be able to show each sales person their full list of expenses across all the customers they are connected to, but not be able to see each others expenses. It's not a problem if the person creating the item for List A ends up with items in List B that are 0, but I need to be able to have the Expense field be an editable text box from a form that allows the sales people to enter their total expenses for that customer.
If I was building a custom application, this wouldn't be difficult to do, but I can't for the life of me figure out how to do this in SharePoint, or if it is even possible.
This is possible, but it will require custom development, using the SharePoint Object Model. Create your two lists and then you can either create a javascript/HTML based solution using libaries like jQuery and SPServices, or you can create a custom web part and use C# to update the lists. There's lot of examples out on the internet on how to do this. Write some code, and bring any problems you have with the code back to StackOverflow.

Infopath - Create a drop-down List from Active Directory "Department" field

Is it possible to create a Drop-down list in InfoPath which connects to Active Directory and fills the list with UNIQUE Department Values only (no repeating ones)
I need this for an InfoPath so when a user entering the data can pick one of the departments listed in the drop-down. Any help would be appreciated.
I've had a look at the people picker control, which works great for User names, but the department field is a separate field and has nothing to do with the user I pick, so I simply need a control which is populated by the unique Department codes in AD.
Any help would be appreciated.
You should really contact your administrator for this sort of information. You do not want a form to query every AD user to pull their department and get the unique values just to populate a drop down list. It is very possible to obtain the list of unique directories, however you should work with your administrator to populate this data to an XML web page or other similar solution and then connect your form to THAT data source through the form. The point is you are missing a step of obtaining the queried data.
With that said you can obtain the department of the user by querying the get user profile service to obtain the department name, elinating the need to even create a populated drop down list. See this article.

How to populate a site column from a list to another list?

I have defined a couple of lists for capturing registration details of the user. There is a list for holding personal details of the user and there is another list which holds professional details of the user.
The two lists are used over two different pages in which name and ID both are required.
How do I get the name and ID populated automatically into the professional list from personal list so as the user doesn't have to fill the similar information twice?
Is it possible without doing any coding stuff?
This little control may help you
http://cascddlistwithfilter.codeplex.com/
Basically you would link the first Cascading drop down control to your user details list and the field name. The second drop down would then filter the users ID so the user can select that.
I have used this before and it can be a pain in the backside to configure but when it's there it is so very powerful and useful.
It's not fully automated but i'm unsure how you would get any closer with a bespoke event receiver.
Create the custom form there, you have keep some text box with the refresh button, so when ever you fill the user id and press the refresh button. You need to right small logic to bring the user from the the source list.
Or you can use the personal details id as look up column in the prop list so you will get the id and select the id and do refresh. Anyway you have right the logic in your custom form code.

Sharepoint: Person column in custom list

I have a Person field in my custom list. I want to have a view that will show multiple fields from that Person instead of the one I had to choose when creating the Person column.
So basically I want to have one column for Person and then in the view see Name, title, email, phone. All of those are valid choices but I can only pick one right now.
I really want to avoid typing in the username lookup for each column I choose to display.
This is SP 2007
It sounds like you need to create a custom fieldtype (with a fieldcontrol) that inherits from the userfield but in viewmode renders out the different columns you need. Is that something along the lines you are looking for?
http://www.sharepointblogs.com/nicksevens/archive/2007/08/31/create-custom-field-types-for-sharepoint.aspx
Note: This link is broken
You probably want a Computed Field. Note that this is not a Calculated Column. A Computed Field is what is used to display the same data is different ways. In SharePoint there is a Title field, but there is also a "Title (linked to item with edit menu)" computed field as well as a "Title (linked to item)" computed field.
See midway down this link for more details. I'm not sure if it will have all of the power that you need, but if it does it is almost certainly what you are looking for if you don't mind getting into the Schema XML file a little.
Could you use a DataView web part for this? If it's just a question of viewing the data that might be suitable.
Came across this thread and thought I'd add a tip. This suggestion is clearly not for every use case, but may work well in situations where you're managing a list rather than allowing manual inputs (verified to work with SP 2013):
Create a spreadsheet with columns to match your SharePoint list that contains multiple profile fields. (for example: name, phone number, email address)
In the spreadsheet, enter the same email address in all of the person/group field types in that row. (e.g., boss#company.com, boss#company.com, boss#company.com)
Select and copy the row(s) you wish to transfer to SharePoint.
In SharePoint, change the list view to "Quick Edit" and paste the row(s) into the grid.
SharePoint will process each field and convert the email address to the profile value you selected during the list setup.

Resources