Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Trigger a Measure with a Button

Hi Community,

 

My goal is to build a report where a user uses a "random button". After clicking this button, it produces a Number between 1 and 100. My idea is to use the Randbetween function. The button should trigger the measure "Measure = RANDBETWEEN(1,100)" and the output ( for example a Card Visual) should be random everytime the user clicks the button.

 

Any ideas how to build a solution is much appreciated!

 

  • Hi  Anonymous ,

     

    First create a table as below:

    Table = GENERATESERIES(1,100,1)

    Then create a measure as below:

    Measure = RANDBETWEEN(1,100)

    Import a custom visual from the market as below:

     

    And you will see the magic:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my reply as a solution!

     

2 Replies

  • v-kelly-msft's avatar
    v-kelly-msft
    Community Support

    Hi  Anonymous ,

     

    First create a table as below:

    Table = GENERATESERIES(1,100,1)

    Then create a measure as below:

    Measure = RANDBETWEEN(1,100)

    Import a custom visual from the market as below:

     

    And you will see the magic:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my reply as a solution!

     

  • this is a good one. I tried the following:

     

    - put the RANDBETWEEN measure on a card

    - added another column to the visual filters

    - created two bookmarks that use different values for this column

    - created two buttons that switch between the bookmarks

     

    Unfortunately RANDBETWEEN does only trigger once for each bookmark. So while you get different values for different filter choices, it's the same values over and over again.

     

    Interesting documentation: RAND function (DAX) - DAX | Microsoft Docs

     

    Of course you could do a report refresh with a PowerApps visual but that seems like overkill.