Forum Discussion

Amar-Agnihotri's avatar
Amar-Agnihotri
Resolver I
4 years ago
Solved

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 

 

Function is working fine and generating bearer access token as shown 

 

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 

 

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

 

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

 

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 -

 

 

But in my case it is showing this error -

 

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 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Amar-Agnihotri 

     

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

    token = Source(continuationToken),

    which should be

    token = Source[continuationToken],

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Amar-Agnihotri 

     

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

    token = Source(continuationToken),

    which should be

    token = Source[continuationToken],
    • Amar-Agnihotri's avatar
      Amar-Agnihotri
      Resolver I

      Hi Anonymous ,

      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 🙂

      • Anonymous's avatar
        Anonymous
        Not applicable

        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...