User-based Data Transformations and Custom Attributes - Video Tip

Have you ever wondered if it’s possible to have data automatically transformed based on the user viewing it? In my case, I need to convert DateTime data stored in UTC-Time to the timezone of the user viewing the data. To do this in Dundas BI, I will utilize Custom Attributes and the Data Cube transformation to apply some code to automatically offset my date data based on the user’s location.

Here is the code used:

Calculated Element 1

return session.CustomAttributes[new Guid(“131db166-56a3-4c80-8c80-c9371dffee75”)].SingleValue;

Calculated Element 2

var timeUtc = $DateTime$;
var userTimeZone = TimeZoneInfo.FindSystemTimeZoneById($TimeZone$);
var today = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, userTimeZone);
return today;

If you’d like to learn more, I’d recommend you go to my learning channel - Off the Charts (with Jeff).
https://www.dundas.com/resources/off-the-charts-tips-from-an-expert

1 Like