Forum Discussion
Power BI Report Subscription "Include Today" Date Filter Bug
- 1 year ago
Hi, _Nick_
Instead of relying on Power Bi's date filters we can create a custom DAX measure to dynamically adjust to the timezone.(UTC or Local timezone).
Here is a step by step procedure .
Step 1 : Creating a 'TodayToronto' MeasureTodayToronto =VAR CurrentUTC = UTCNOW()VAR TimeOffset =IF(MONTH(CurrentUTC) > 3 && MONTH(CurrentUTC) < 11,-4,-5)RETURNDATE(YEAR(CurrentUTC),MONTH(CurrentUTC),DAY(CurrentUTC + TimeOffset / 24))
This measure calculates Toronto’s current date by adding the TimeOffset to the current UTC time.
Step 2: Create a 'IsTodayToronto' Measure for Filtering Today’s DataIsTodayToronto =IF(DATE(YEAR(MAX(SalesData[Date and Time])),MONTH(MAX(SalesData[Date and Time])),DAY(MAX(SalesData[Date and Time]))) = [TodayToronto],1,0)This measure filters data based on the date from 'TodayToronto' measure like '1' for dates in 'TodayToronto'
and '0' for other dates.
Now applying the measures and filters in Power bi desktop.
I created a sample dataset for representing and applied the measures and filters like below images.
DatasetVisualizing:
This is before applying 'IsTodayToronto' measure in the Filters,
After applying 'IsTodayToronto' measure and condition is 1 in the Filters
As you can see the measure is filtering todays date data .
Now you can Test the Solution with Power BI’s Email Subscription by setting up the subscription Email and scheduling it with your desired time(eg.7:00 P.M Toronto time).
Then you can verify the data.
Please give a kudos and accept it as solution if it meets your goals.
Thanks,
Vinay.
Hi, _Nick_
Instead of relying on Power Bi's date filters we can create a custom DAX measure to dynamically adjust to the timezone.(UTC or Local timezone).
Here is a step by step procedure .
Step 1 : Creating a 'TodayToronto' Measure
This measure calculates Toronto’s current date by adding the TimeOffset to the current UTC time.
Step 2: Create a 'IsTodayToronto' Measure for Filtering Today’s Data
This measure filters data based on the date from 'TodayToronto' measure like '1' for dates in 'TodayToronto'
and '0' for other dates.
Now applying the measures and filters in Power bi desktop.
I created a sample dataset for representing and applied the measures and filters like below images.
Dataset
Visualizing:
This is before applying 'IsTodayToronto' measure in the Filters,
After applying 'IsTodayToronto' measure and condition is 1 in the Filters
As you can see the measure is filtering todays date data .
Now you can Test the Solution with Power BI’s Email Subscription by setting up the subscription Email and scheduling it with your desired time(eg.7:00 P.M Toronto time).
Then you can verify the data.
Please give a kudos and accept it as solution if it meets your goals.
Thanks,
Vinay.