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
evolve_Tricia
Helper I
Helper I

Calculated column for dynamic time zone

Hi,
I need to create a calculated column for dynamic time zone conversion when a specific time zone is created. 

 

There is a table with time zone and time difference from UTC. 

 

擷取.JPG

I have a table of orders as below, with order_id, original dates of orders. 
time_diff is a measure:

 

time_diff = IF(
    ISFILTERED('Time Zones'[Time Zone]),
     TIME(DISTINCT('Time Zones'[Time Diff from UTC]), 0, 0)
)

 

 

date_converted is a calculated column

 

date_converted = FORMAT('orders'[date_original]+[time_diff], "General Date")

 

 

This is the expected results

order_iddate_originaltime_diffdate_converted
12020/10/11 2:00 AM08:00:002020/10/11 10:00 AM
22020/10/11 8:00 AM08:00:002020/10/11 4:00 PM
32020/10/11 2:00 PM08:00:002020/10/11 10:00 PM
42020/10/11 8:00 PM08:00:002020/10/12 4:00 AM
52020/10/12 2:00 AM08:00:002020/10/12 10:00 AM
62020/10/12 8:00 AM08:00:002020/10/12 4:00 PM
72020/10/12 2:00 PM08:00:002020/10/12 10:00 PM
82020/10/12 8:00 PM08:00:002020/10/13 4:00 AM
92020/10/13 2:00 AM08:00:002020/10/13 10:00 AM
102020/10/13 8:00 AM08:00:002020/10/13 4:00 PM
112020/10/13 2:00 PM08:00:002020/10/13 10:00 PM
122020/10/11 2:00 AM08:00:002020/10/11 10:00 AM
132020/10/11 8:00 AM08:00:002020/10/11 4:00 PM

 

However, the date converted didn't change at all! What could be the problem?

擷取.JPG

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @evolve_Tricia ,

 

If you want dynamic, you need to change the calculate column to measure.

Please refer this measure.

 

date_converted = FORMAT(MAX(orders[date_original])+[time_diff], "General Date")

 

cal1.jpg

 

cal2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hi @evolve_Tricia ,

 

If you want dynamic, you need to change the calculate column to measure.

Please refer this measure.

 

date_converted = FORMAT(MAX(orders[date_original])+[time_diff], "General Date")

 

cal1.jpg

 

cal2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

lbendlin
Super User
Super User

Calculated Column <> Dynamic

 

A calculated column is a static value.  You will want to use a measure instead, or rethink your logic.

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.