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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Amar-Agnihotri
Resolver I
Resolver I

We cannot convert a value of type Record to type Function.

Hi,

I have created a function to call Activity events REST api to get user activity for the last 30 days. FOe Bearer Access token i have created another function. Here is the code -

 

Get Access Token 

AmarAgnihotri_0-1655119870960.png

 

Function is working fine and generating bearer access token as shown 

AmarAgnihotri_1-1655119916981.png

 

Now to get User Activity data using Activity events api i have created a list of dates and two custom columns for startdate and enddate as 

AmarAgnihotri_2-1655119979810.png

 

Now i have created another function GetActivity to call REST API as - 

AmarAgnihotri_3-1655120031876.png

 

Now i am adding a custom column in a query to generate the list of user activity data by making a call of this custom function as

 

AmarAgnihotri_4-1655120096593.png

In the above snap it is clear that Get Activity function is calling Get Access token function inside to get the Bearer access token and it is picking up the startdate and enddate from the columns defined above , Noiw it should a list activity as shown -

 

AmarAgnihotri_5-1655120183291.png

 

But in my case it is showing this error -

 

AmarAgnihotri_6-1655120215407.png

Can anyone help my out to resolve this . I am following Bi Elite video to crteate an admin panel -

This is the link of video 

https://www.youtube.com/watch?v=Z4E2jSZ4r6A&list=PLL-WSn9hvefogtxxi7CJhjLCJvrDY0mpQ&index=4

 

and this is the link of the M code  - 

 

https://bielite.com/blog/building-a-power-bi-admin-report/

 

 

Thanks in advance 

 

1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Amar-Agnihotri 

 

The only difference I can see is in your Get Activity Function

token = Source(continuationToken),

which should be

token = Source[continuationToken],

View solution in original post

4 REPLIES 4
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Amar-Agnihotri 

 

The only difference I can see is in your Get Activity Function

token = Source(continuationToken),

which should be

token = Source[continuationToken],

Hi @Vera_33 ,

You are right. That was a silly mistake and now eveything is working fine. You are like an angel for me. Thanks a lot sister 🙂

Hi @Amar-Agnihotri 

 

Good practice to type out instead of copy paste all the M code, for the naming of custom function, my personal habit is to prefix with "fx" or "fn", and no space, so it is easier to debug...

Thanks 😊

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors