Connect Power BI Template to Active Directory

Enhancing the data from Anywhere365 with information Active Directory.

Prerequisites

  • Have a Power BI file with the Anywhere365 view loaded in (using the template for example)

 

Quick Setup

Quick setup is useful if you just want department and displayname. If you want to choose specific field or filter you can change the applied steps.

  1. Select Get Data
  2. Select Blank Query

  1. Select Advanced Editor

  1. Copy the following code (change the domain to your own domain)

let

Source = ActiveDirectory.Domains("domain.com"),

domain.com = Source{[Domain="domain.comt"]}[#"Object Categories"],

contact1 = domain.com{[Category="contact"]}[Objects],

#"Expanded mailRecipient" = Table.ExpandRecordColumn(contact1, "mailRecipient", {"mail"}, {"mailRecipient.mail"}),

#"Expanded organizationalPerson" = Table.ExpandRecordColumn(#"Expanded mailRecipient", "organizationalPerson", {"company", "department", "division", "manager"}, {"organizationalPerson.company", "organizationalPerson.department", "organizationalPerson.division", "organizationalPerson.manager"}),

#"Grouped Rows" = Table.Group(#"Expanded organizationalPerson", {"mailRecipient.mail"}, {{"displayName", each List.Max([displayName]), type text}, {"department", each List.Max([organizationalPerson.department]), type text}, {"manager", each List.Max([organizationalPerson.manager]), type record}}),

#"Removed Duplicates" = Table.Distinct(#"Grouped Rows", {"mailRecipient.mail"}),

#"Filtered Rows" = Table.SelectRows(#"Removed Duplicates", each ([mailRecipient.mail] <> null)),

#"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"mailRecipient.mail", "MailAddress"}})

in

#"Renamed Columns"

  1. If this is your first time connection, enter your credentials
  2. Click Done
  3. (optional) Rename Name
  4. Click Close & Apply
  5. Open tab Relations
  6. Connect PowerBI_Dialogue.initialagent with Query1.MailAddress