Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a table that stores the timezone related data to perform calculations based on the user selected timezone.
I want to select the Hours and Minutes value from this table for a selected timezone and then convert it as follows:
var curDate =
SWITCH ( TRUE(),
relativeToUTC = ‘Post’, UTCNOW() + TIME(timeZone_hours,timeZone_minutes,0),
relativeToUTC = ‘Pre’, UTCNOW() - TIME(timeZone_hours,timeZone_minutes,0),
)
Here is the table
Solved! Go to Solution.
var curDate =
SWITCH ( TRUE(),
SELECTEDVALUE('Table'[relativeToUTC] = ‘Post’,
UTCNOW() + TIME(SELECTEDVALUE('Table'[timeZone_hours],SELECTEDVALUE('Table'[timeZone_minutes],0),
SELECTEDVALUE('Table'[relativeToUTC] = ‘Pre’,
UTCNOW() - TIME(SELECTEDVALUE('Table'[timeZone_hours],SELECTEDVALUE('Table'[timeZone_minutes],0),
)
var curDate =
SWITCH ( TRUE(),
SELECTEDVALUE('Table'[relativeToUTC] = ‘Post’,
UTCNOW() + TIME(SELECTEDVALUE('Table'[timeZone_hours],SELECTEDVALUE('Table'[timeZone_minutes],0),
SELECTEDVALUE('Table'[relativeToUTC] = ‘Pre’,
UTCNOW() - TIME(SELECTEDVALUE('Table'[timeZone_hours],SELECTEDVALUE('Table'[timeZone_minutes],0),
)
But I have a slicer that will let the users to choose the timezone such as Los Angeles. How do I incorporate that filter?
If you put the TimeZone column on the slicer, and choose the force single selection option, then that will do the filtering
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.