Forum Discussion
Convert Timezone based on User Selection (PowerBI.com)
What I would do, is to create a disconnected table which would have the different hours for the different time zones.
I would then take the value being selected from the user and then this would change the measure for the time for the user.
This would then reflect the time in their time zone. Along with the persistent filters, every time the user logged in it would remember and show them the data in their timezone.
Thank you GilbertQ for responding to my post.
I understand the principle of creating a Disconnected Table that would contain the various Timezones available for the user to Select and then I would use a Slicer based on the Disconnected Table allowing the user to make a selection. I then assume that I would need to create a New Measure using the SelectedValue() and Switch() functions to determine what value was selected in the Slicer.
However, what I do not understand is how I can use a Measure to convert the Date/Time fields on a record by record bases. To my knowledge Measures expect to generate totals across multiple records at the time the Visual is being loaded, whereas Calculated Columns perform calculations at the Record Level but only during the data refresh which occurs prior to the visuals being loaded or the user making a selection.
At the Dax Level I can create a Calculated Column for every timezone supported using code similar to the following:
DateTimeField_PST = MyTable[DateTimeField] + ((1/24)*-8) (This is for Pacific Standard Time)
DateTimeField_LocalTime =
VAR ValueSelected = SELECTEDVALUE('Time Zones'[Time Zone], "PST")
VAR Offset =
CALCULATE (
FIRSTNONBLANK ( 'Time Zones'[Offset], TRUE() ),
FILTER ( ALL ( 'Time Zones' ), 'Time Zones'[Time Zone] = ValueSelected)
)
RETURN
MyTable[DateTimeField] + ((1/24)*Offset)Thank you