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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Fixed Time Buttons for Table

Hi, 

 

Could you help me how I can create this buttons on the picture? Basically, the requirement is when you click on the button on the report page, table should be updated with the selected option.  For instance, when clicking 24 hours, the table should be updated with last 24 hours data.  

 

timebuttons.PNG

 

Thank you, 

Yavuz

 

P.S. I can provide more information if needed

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous,

 

May be you can try use the slicer like the following :

vchenwuzmsft_0-1641800966110.png

 

If this ok, create a measure as a dynamic tag and let it in filters pane.

vchenwuzmsft_2-1641802215505.png

Measure = 
var _2hours = NOW()-TIME(2,0,0)
var _12hours = NOW()-TIME(12,0,0)
var _24hours = NOW()-TIME(23,59,59)
var _weekhours = NOW()-TIME(23,59,59)*7
var _month = NOW()-TIME(23,59,59)*30
return
SWITCH(TRUE(),
SELECTEDVALUE(Button[button])="2 hours",_2hours,
SELECTEDVALUE(Button[button])="12 hours",_12hours,
SELECTEDVALUE(Button[button])="24 hours",_24hours,
SELECTEDVALUE(Button[button])="week",_weekhours,
SELECTEDVALUE(Button[button])="month",_month,TIME(0,0,0))

Measure 2 = IF(SELECTEDVALUE('Table'[DateTime])>=[Measure],1,BLANK())

 

 

If you want use button, bookmarks and slicer are used in combination. Bookmarks are linked to the specified slicer.

vchenwuzmsft_1-1641802153388.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

 

 

View solution in original post

9 REPLIES 9
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous,

 

May be you can try use the slicer like the following :

vchenwuzmsft_0-1641800966110.png

 

If this ok, create a measure as a dynamic tag and let it in filters pane.

vchenwuzmsft_2-1641802215505.png

Measure = 
var _2hours = NOW()-TIME(2,0,0)
var _12hours = NOW()-TIME(12,0,0)
var _24hours = NOW()-TIME(23,59,59)
var _weekhours = NOW()-TIME(23,59,59)*7
var _month = NOW()-TIME(23,59,59)*30
return
SWITCH(TRUE(),
SELECTEDVALUE(Button[button])="2 hours",_2hours,
SELECTEDVALUE(Button[button])="12 hours",_12hours,
SELECTEDVALUE(Button[button])="24 hours",_24hours,
SELECTEDVALUE(Button[button])="week",_weekhours,
SELECTEDVALUE(Button[button])="month",_month,TIME(0,0,0))

Measure 2 = IF(SELECTEDVALUE('Table'[DateTime])>=[Measure],1,BLANK())

 

 

If you want use button, bookmarks and slicer are used in combination. Bookmarks are linked to the specified slicer.

vchenwuzmsft_1-1641802153388.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

 

 

Anonymous
Not applicable

I think this is better and faster way.

"If you want use button, bookmarks and slicer are used in combination. Bookmarks are linked to the specified slicer." So I created buttons, bookmarks and slicer, but some reason it does not update my table with last 2 hours or 24 hours when I clicked on buttons. Please tell me @v-chenwuz-msft  where I missed the point. 

 

Hi @Anonymous ,

 

More instructions with steps

1 Create 4 buttons, one slicer and 4 bookmarks.

on 2 hours bookmark, select '2 hours' in slicer and hide the slicer. update '2 hours' bookmark.

other bookmarks are same as it. Hide the slier after selecting.

 

2 Set the action of buttons.

 

You can refer this video in the end.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

 

Anonymous
Not applicable

That's it! Thank you so much @v-chenwuz-msft !This is the exactly what I needed it! I understood everything on video was helpful, I think I miss one point it is on the pict. When you dragged If > start measure. Please could you explain how also created this Button sections and If>, etc measures. Please.. Looking forward to complete it when you send me another video. Thank you!measures.PNG

Hi @Anonymous ,

 

Button table, I created this table via enter data.

vchenwuzmsft_0-1641956638038.png

 

'IF>start' is the 'measure 2'.

When you write selectedvalue in measure( StartTime ), the value after the equal sign should be the value in your button table.

Now = Now()

 

Best Regards

Community Support Team _ chenwu zhu

 

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

 

 

 

Anonymous
Not applicable

Thank you, @v-chenwuz-msft again. I opened your file and started to create Button table. Now, I am on to write DAx formulas but my question is should I select my value from table when writing Selected Value. 

Measure = 
var _2hours = NOW()-TIME(2,0,0)
var _12hours = NOW()-TIME(12,0,0)
var _24hours = NOW()-TIME(23,59,59)
var _weekhours = NOW()-TIME(23,59,59)*7
var _month = NOW()-TIME(23,59,59)*30
return
SWITCH(TRUE(),
SELECTEDVALUE(Button[button])="2 hours",_2hours,
SELECTEDVALUE(Button[button])="12 hours",_12hours,
SELECTEDVALUE(Button[button])="24 hours",_24hours,
SELECTEDVALUE(Button[button])="week",_weekhours,
SELECTEDVALUE(Button[button])="month",_month,TIME(0,0,0))

Measure 2 = IF(SELECTEDVALUE('Table'[DateTime])>=[Measure],1,BLANK())

 

Anonymous
Not applicable

Thank you so much @v-chenwuz-msft ! This is exactly what I was looking for it! Great job! I can not enough thank you.  Sending file amazing! Please do you mind if you create a short fast video for me, however you did this two pages? I will be so happy.  I am still learning Power BI and I am getting better. Please do it for me even if you do not want add voice or speak its totally fine, just I like to see to how did all steps.  Looking forward to hearing from you. 

amitchandak
Super User
Super User

@Anonymous , bookmarks and button

or measure slicer

Bookmarks
https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive
https://docs.microsoft.com/en-us/power-bi/desktop-bookmarks

 

measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

data.PNG

 

Thank you for replying. Here is my data if it makes more sense for help. I do not think Bookmark and button works for it. I know how to use bookmark and blank button, please can give me more specific idea  or other options ? 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors