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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Pker_Tank
Regular Visitor

Display names of users and a button to approve on Power BI Report

Hi,

 

I have this use case and would really appreciate your help.

 

Use Case:

On the report, there are sections at the bottom like, Print Name:___________ and Signature:___________ and Date:____________________
When user A accesses the report, the Print Name should have his/her First Name space Last Name. The Signature will be a button, and when pressed, an email needs to be sent via Outlook to the manager with a link to the report and it should have the above name, signature (which is name again), and date printed on the report.

Is there a way to do that? Thanks heaps in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from BeaBF, please allow me to provide another insight.
Hi @Pker_Tank ,

 

Please refer to the following steps.

Register an application.
Register an application with the Microsoft identity platform - Microsoft Graph | Microsoft Learn


Add API License: Microsoft Graph User.Read.All permission for the application type and add the delegation.

vdengllimsft_0-1737361688978.png

 

Copy the tenant id, client id, and client secret.

vdengllimsft_1-1737362583751.pngvdengllimsft_2-1737362616334.png

 

Then use the following M code to get a list of all the users in the tenant.

let
    clientId ="<Your clientId>",
    tenantId = "<Your tenantId>",
    clientSecret = "<Your clientSecret>",
    tokenUrl = "https://login.microsoftonline.com/" & tenantId &"/oauth2/v2.0/token",
    body=
    [
    client_id = clientId,
    scope = "https://graph.microsoft.com/.default",
    grant_type = "client_credentials",
    client_secret = clientSecret
    ],
    tokenResponse = Json.Document(Web.Contents(tokenUrl,
    [
    Content = Text.ToBinary(Uri.BuildQueryString(body)),
    Headers = [Accept = "application/json"]
    ])),
    AccessToken = tokenResponse[access_token],
    Source = Json.Document(Web.Contents("https://graph.microsoft.com/v1.0/users",
    [
        Headers = [Authorization = "Bearer " & AccessToken]
    ])),
    #"Converted to Table" = Table.FromList(Source[value], Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"businessPhones", "displayName", "givenName", "jobTitle", "mail", "mobilePhone", "officeLocation", "preferredLanguage", "surname", "userPrincipalName", "id"}, {"businessPhones", "displayName", "givenName", "jobTitle", "mail", "mobilePhone", "officeLocation", "preferredLanguage", "surname", "userPrincipalName", "id"})
in
    #"Expanded Column"

vdengllimsft_3-1737363170756.png


Then use the following measure to show the display name of the currently logged in user.

PrintName = CALCULATE(MAX(Users[displayName]),Users[mail]=USERPRINCIPALNAME())


Create a Power Automate Flow visual to send emails. You can add fields as well as measures to include the information to be sent.

Create a Power Automate visual for Power BI - Power BI | Microsoft Learn

vdengllimsft_4-1737363835410.png

 

Add the Send an email (V2) action to Power Automate Flow and populate the options in it. And save the report and publish it to Power BI Service.

vdengllimsft_5-1737364152137.png


Create a separate page for displaying the target report. Copy the URL of the report page as the target report link for the email to be sent. Then click Save and Apply in the upper right corner.

vdengllimsft_6-1737364289695.pngvdengllimsft_7-1737364385649.png


Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks for the reply from BeaBF, please allow me to provide another insight.
Hi @Pker_Tank ,

 

Please refer to the following steps.

Register an application.
Register an application with the Microsoft identity platform - Microsoft Graph | Microsoft Learn


Add API License: Microsoft Graph User.Read.All permission for the application type and add the delegation.

vdengllimsft_0-1737361688978.png

 

Copy the tenant id, client id, and client secret.

vdengllimsft_1-1737362583751.pngvdengllimsft_2-1737362616334.png

 

Then use the following M code to get a list of all the users in the tenant.

let
    clientId ="<Your clientId>",
    tenantId = "<Your tenantId>",
    clientSecret = "<Your clientSecret>",
    tokenUrl = "https://login.microsoftonline.com/" & tenantId &"/oauth2/v2.0/token",
    body=
    [
    client_id = clientId,
    scope = "https://graph.microsoft.com/.default",
    grant_type = "client_credentials",
    client_secret = clientSecret
    ],
    tokenResponse = Json.Document(Web.Contents(tokenUrl,
    [
    Content = Text.ToBinary(Uri.BuildQueryString(body)),
    Headers = [Accept = "application/json"]
    ])),
    AccessToken = tokenResponse[access_token],
    Source = Json.Document(Web.Contents("https://graph.microsoft.com/v1.0/users",
    [
        Headers = [Authorization = "Bearer " & AccessToken]
    ])),
    #"Converted to Table" = Table.FromList(Source[value], Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"businessPhones", "displayName", "givenName", "jobTitle", "mail", "mobilePhone", "officeLocation", "preferredLanguage", "surname", "userPrincipalName", "id"}, {"businessPhones", "displayName", "givenName", "jobTitle", "mail", "mobilePhone", "officeLocation", "preferredLanguage", "surname", "userPrincipalName", "id"})
in
    #"Expanded Column"

vdengllimsft_3-1737363170756.png


Then use the following measure to show the display name of the currently logged in user.

PrintName = CALCULATE(MAX(Users[displayName]),Users[mail]=USERPRINCIPALNAME())


Create a Power Automate Flow visual to send emails. You can add fields as well as measures to include the information to be sent.

Create a Power Automate visual for Power BI - Power BI | Microsoft Learn

vdengllimsft_4-1737363835410.png

 

Add the Send an email (V2) action to Power Automate Flow and populate the options in it. And save the report and publish it to Power BI Service.

vdengllimsft_5-1737364152137.png


Create a separate page for displaying the target report. Copy the URL of the report page as the target report link for the email to be sent. Then click Save and Apply in the upper right corner.

vdengllimsft_6-1737364289695.pngvdengllimsft_7-1737364385649.png


Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

BeaBF
Super User
Super User

@Pker_Tank Hi! 

to display name and last name, you can create a measure with this funtion:
UserName = UserPrincipalName()
Userprincipalname function retrieves the email of the user that is using the Report, then you can modify it to obatin name and last name. If you can write me the form of your org email, i can help you to adjust the measure to obatin name space last name.

To create the button, you can insert a button that will be the trigger of a Power Automate Flow, you can't send email directly from power bi desktop.

BBF

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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