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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

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!

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
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:

vkellymsft_0-1628501941134.png

 

And you will see the magic:

vkellymsft_1-1628501966873.png

vkellymsft_3-1628502159900.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
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:

vkellymsft_0-1628501941134.png

 

And you will see the magic:

vkellymsft_1-1628501966873.png

vkellymsft_3-1628502159900.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

lbendlin
Super User
Super User

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.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors