Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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!
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?
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |