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

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

Reply
Anonymous
Not applicable

Date + Time Input Variable for Measure

Hi Together,

i got following problem:

 

I made a Measure, which creates me a new column with 0 or 1 to mark all Timestamps which are inbetween of the two variables of my measure.

 

 

InDateTimeRange =

var _rangeStart= DATE(2022,01,01) + TIME(08,00,0)

var _rangeEnd = DATE(2022,01,15) + TIME(08,00,00)

return

IF(

SELECTEDVALUE(Data[TimestampFrom]) >= _rangeStart

&& SELECTEDVALUE(Data[TimestampTo]) <= _rangeEnd

&& SELECTEDVALUE(Data[TimestampTo]) <>BLANK()

, 1, 0)

 

 

This measure is working fine for me, BUT the hardcoded red part (DATE + TIME) needs to be changed to something the user can select on the report. Input parameters are not working for me, because they can only store decimal numbers or numbers. The time part is also very important for me, just the date would not be enough..

 

Thanks a lot!

 

Lennart

6 REPLIES 6
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

I just want to confirm if you resolved this issue? If yes, you can accept the answer helpful as the solution or share you method and accept it as solution, thanks for your contribution to improve Power BI.

If you need more help, please let me know.

 

Best Regards,

Community Support Team _Tang

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

Tahreem24
Super User
Super User

@Anonymous For example if you have a DateTime slicer so you can use SELECTEDVALUE() function.

eg. SelectedValue(TableName[DateTime Column])

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

Can you give me an example ? I am not able to use Selectedvalue in my formula. 

Anonymous
Not applicable

Thank you. How can I filter a Visual by a date and time range otherwise ? 

Hi @Anonymous ,

How can I filter a Visual by a date and time range otherwise ? 

Pls refer this:

https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?MessageKey=904b228b-a028-4562-96bf-ce08754b302d&CommunityKey=b35c8468-2fd8-4e1a-8429-322c39fe7110&tab=digestviewer

 

Use dimension tables to filter your visuals.

amitchandak
Super User
Super User

@Anonymous , A measure or slicer value can not be used in a calculated column. You need use measure

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.