Forum Discussion

MikeKKK's avatar
MikeKKK
Frequent Visitor
4 years ago
Solved

Count link clicked within Power BI report

I am working on a Power BI report that contains a number links to other reports and files.   I would like to record number of clicks of each link when user clicks, within this Power BI report.

 

I understand that this cannot be done in PowerBI, but perhaps it could be done with PowerApps visual? 

 

Has anyone walked the path before? or have some showcases or example to share?

  • Hi,   MikeKKK 

     

    Having no experience with Power App, the following case seems to fit your needs.

    Count the number of times clicked

     

    Create a table like this called CountOfClicks

    URL TotalClicks
    www.google.ca 23
    www.arstechnica.com 4
    www.reddit.com 34

     

    Assuming the gallery holds the URL you could put this code in the OnSelect property of your button to track clicks

    Set(currentRecord, LookUp(CountOfClicks, URL = ThisItem.Hyperlink));
    
    If(
        IsBlank(currentRecord),
        //create a new record when URL is new and start at 1 click
        Patch(CountOfClicks, Defaults(), {URL = ThisItem.Hyperlink, Clicks: 1}),
        //add clicks to a record when URL already exists
        Patch(CountOfClicks, currentRecord, {Clicks: currentRecord.Clicks + 1})
    )

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng


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

5 Replies

  • Hi,   MikeKKK 

     

    Having no experience with Power App, the following case seems to fit your needs.

    Count the number of times clicked

     

    Create a table like this called CountOfClicks

    URL TotalClicks
    www.google.ca 23
    www.arstechnica.com 4
    www.reddit.com 34

     

    Assuming the gallery holds the URL you could put this code in the OnSelect property of your button to track clicks

    Set(currentRecord, LookUp(CountOfClicks, URL = ThisItem.Hyperlink));
    
    If(
        IsBlank(currentRecord),
        //create a new record when URL is new and start at 1 click
        Patch(CountOfClicks, Defaults(), {URL = ThisItem.Hyperlink, Clicks: 1}),
        //add clicks to a record when URL already exists
        Patch(CountOfClicks, currentRecord, {Clicks: currentRecord.Clicks + 1})
    )

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng


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

      • v-angzheng-msft's avatar
        v-angzheng-msft
        Icon for Community Support rankCommunity Support

        Hi, MikeKKK 

         

        May I ask if the above post is helpful to you?

        If  it does, could you please mark the post which help as Answered? It means a lot to me, and it will help the others in the community find the solution easily if they face the same problem with you. Thank you.😀

         

         

        Best Regards,
        Community Support Team _ Zeon Zheng

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

    • casperlow's avatar
      casperlow
      Icon for Helper I rankHelper I

      Have anyone manage to get this working? I'm trying to apply it to Power BI but I'm having trouble on where to use it. is it on a the Dax measure? or Power Query? im probably asking the wrong question but I would appreciate if there's any direction or an instruction break down on how to apply this on Power BI?