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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AllanBerces
Post Prodigy
Post Prodigy

TimeZone PQ to Calculated Column

Hi good day,

Can someone help me on how can i convert my PQ Timezone custom column to calculated column.

 

"Today", each if [PlanDate] < Date.From(DateTime.From(DateTimeZone.RemoveZone(DateTimeZone.UtcNow()) + #duration(0,8,0,0))) then 0 else [PlanDate])

 

Thank you

2 ACCEPTED SOLUTIONS
Prasad_chattu
Regular Visitor

Hello @AllanBerces 

Please try the below DAX column :


Today =
VAR AdjustedDate = DATE(YEAR(UTCNOW()), MONTH(UTCNOW()), DAY(UTCNOW())) + (8/24)
RETURN IF( [PlanDate] < AdjustedDate, 0, [PlanDate])

I have tried with sample data :
Prasad_chattu_0-1741138982710.png


Let me know if it works or not.

Thank you.




View solution in original post

danextian
Super User
Super User

Hi @AllanBerces 

 

Please try this:

test = 
IF (
   // Convert the current UTC date-time to an integer (removing the time component)
   // 'UTCNOW()' returns the current UTC timestamp.
   // 'DIVIDE(8,24)' converts 8 hours into a fraction of a day (since 1 day = 24 hours).
   // Adding this fraction to 'UTCNOW()' adjusts the time to UTC+8.
   // 'INT(...)' ensures we only compare the **date part**, discarding the time.
   'Table'[Plan Date] < INT( UTCNOW() + DIVIDE(8,24)), 
    
    // If 'Plan Date' is earlier than the adjusted current date, return 0.
    0,  
    
    // Otherwise, return the original 'Plan Date'.
    'Table'[Plan Date]  
)




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @AllanBerces 

 

Please try this:

test = 
IF (
   // Convert the current UTC date-time to an integer (removing the time component)
   // 'UTCNOW()' returns the current UTC timestamp.
   // 'DIVIDE(8,24)' converts 8 hours into a fraction of a day (since 1 day = 24 hours).
   // Adding this fraction to 'UTCNOW()' adjusts the time to UTC+8.
   // 'INT(...)' ensures we only compare the **date part**, discarding the time.
   'Table'[Plan Date] < INT( UTCNOW() + DIVIDE(8,24)), 
    
    // If 'Plan Date' is earlier than the adjusted current date, return 0.
    0,  
    
    // Otherwise, return the original 'Plan Date'.
    'Table'[Plan Date]  
)




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Prasad_chattu
Regular Visitor

Hello @AllanBerces 

Please try the below DAX column :


Today =
VAR AdjustedDate = DATE(YEAR(UTCNOW()), MONTH(UTCNOW()), DAY(UTCNOW())) + (8/24)
RETURN IF( [PlanDate] < AdjustedDate, 0, [PlanDate])

I have tried with sample data :
Prasad_chattu_0-1741138982710.png


Let me know if it works or not.

Thank you.




Hi @danextian @Prasad_chattu Thank you very much, working as i need.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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