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

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.

Reply
sprakash99
Frequent Visitor

How to select one particular row and column value using DAX

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

Screenshot 2022-03-28 at 7.12.06 PM.png

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

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),
)

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors