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
Imrans123
Advocate V
Advocate V

Converting DAX TODAY() to local timezone

Quick question. Wondering if anyone has dealt with this before?

I have a measure where I declare TODAY() as a var


i.e.
VAR MinDate = TODAY()

 

And then I use this to add filter context using

CALCULATE(
[Measure]
FILTER(
ALL(DimDates[Date]),
DimDates[Date] >= MinDate
)
)


Issue is that when I working on PBI Desktop, this works fine since it's calculating TODAY from my local timezone. However, when I publish onto service, it changes TODAY to be with respect to the UTC timezone which is 7 hours ahead.

 

I have tried to use Var MinDate = NOW()-(7/24) to match my local timezone but it doesn't change the result.

 

Just fyi, DimDates[Date] is a Date Field, not DateTime. My data model requires that data type.

 

Any leads would be helpful. Thanks!

1 REPLY 1
OwenAuger
Super User
Super User

Hi @Imrans123 

 

Here is how I would write MinDate:

 

VAR MinDate =
CONVERT (
    INT ( NOW () - 7/24 ),
    DATETIME
)

 

or

 

VAR MinDate =
INT ( NOW () - 7/24 )

 

 

INT is used to round down NOW () - 7/24 to the nearest whole number, which is effectively the date component of NOW () - 7/24.

CONVERT (...) is not strictly necessary as Datetime values can be used interchangeably with the corresponding serial numbers.

 

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

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.