Forum Discussion
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.
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_id | date_original | time_diff | date_converted |
| 1 | 2020/10/11 2:00 AM | 08:00:00 | 2020/10/11 10:00 AM |
| 2 | 2020/10/11 8:00 AM | 08:00:00 | 2020/10/11 4:00 PM |
| 3 | 2020/10/11 2:00 PM | 08:00:00 | 2020/10/11 10:00 PM |
| 4 | 2020/10/11 8:00 PM | 08:00:00 | 2020/10/12 4:00 AM |
| 5 | 2020/10/12 2:00 AM | 08:00:00 | 2020/10/12 10:00 AM |
| 6 | 2020/10/12 8:00 AM | 08:00:00 | 2020/10/12 4:00 PM |
| 7 | 2020/10/12 2:00 PM | 08:00:00 | 2020/10/12 10:00 PM |
| 8 | 2020/10/12 8:00 PM | 08:00:00 | 2020/10/13 4:00 AM |
| 9 | 2020/10/13 2:00 AM | 08:00:00 | 2020/10/13 10:00 AM |
| 10 | 2020/10/13 8:00 AM | 08:00:00 | 2020/10/13 4:00 PM |
| 11 | 2020/10/13 2:00 PM | 08:00:00 | 2020/10/13 10:00 PM |
| 12 | 2020/10/11 2:00 AM | 08:00:00 | 2020/10/11 10:00 AM |
| 13 | 2020/10/11 8:00 AM | 08:00:00 | 2020/10/11 4:00 PM |
However, the date converted didn't change at all! What could be the problem?
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")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.
2 Replies
- lbendlinSuper User
Calculated Column <> Dynamic
A calculated column is a static value. You will want to use a measure instead, or rethink your logic.
- v-zhenbw-msftCommunity 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")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.