The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
28 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
33 | |
13 | |
12 | |
9 | |
7 |