Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Given the following dax table, all dates in GB format,
Solved! Go to Solution.
Hi @MarkH
The short answer is that when using TIME(1,0,0) as the increment in GENERATESERIES, some numerical error is introduced since the values are converted to floating point in the course of the repeated summation.
Here's one way you could rewrite to get around this issue, with some variables added for clarity
(this will end at 23:00 rather than 0:00 on the last date though):
Time - DST2 =
VAR TimeValues =
SELECTCOLUMNS ( GENERATESERIES ( 0, 23 ), "@Time", TIME ( [Value], 0, 0 ) )
VAR DateValues =
GENERATESERIES (
DATE ( 2024, 1, 1 ), // Start date (January 1, 2024)
DATE ( 2026, 12, 31 ) // End date (December 31, 2025)
)
VAR DateTimeValues =
SELECTCOLUMNS (
GENERATE (
DateValues,
TimeValues -- 0:00 to 23:00
),
"Value", [Value] + [@Time]
)
RETURN
ADDCOLUMNS (
ADDCOLUMNS (
DateTimeValues,
"BST",
[Value] + ( 1 / 24 ) //value has been renamed the GMT column
,
"StartSunday",
VAR d =
DATE ( YEAR ( [Value] ), 3, 1 ) // Assuming March as an example
VAR r =
EOMONTH ( d, 0 ) - MOD ( WEEKDAY ( EOMONTH ( d, 0 ), 2 ), 7 )
RETURN
r,
"FinishSunday",
VAR d =
DATE ( YEAR ( [Value] ), 10, 1 ) // Assuming March as an example
VAR r =
EOMONTH ( d, 0 ) - MOD ( WEEKDAY ( EOMONTH ( d, 0 ), 2 ), 7 )
RETURN
r
),
//end of addcolumns
"DST",
IF ( [StartSunday] < [Value] && [FinishSunday] > [Value], "BST", "GMT" )
)
//end of addcolumns
Note: CROSSJOIN could also be used in place of GENERATE here.
Does this work for you?
Hi @MarkH
The short answer is that when using TIME(1,0,0) as the increment in GENERATESERIES, some numerical error is introduced since the values are converted to floating point in the course of the repeated summation.
Here's one way you could rewrite to get around this issue, with some variables added for clarity
(this will end at 23:00 rather than 0:00 on the last date though):
Time - DST2 =
VAR TimeValues =
SELECTCOLUMNS ( GENERATESERIES ( 0, 23 ), "@Time", TIME ( [Value], 0, 0 ) )
VAR DateValues =
GENERATESERIES (
DATE ( 2024, 1, 1 ), // Start date (January 1, 2024)
DATE ( 2026, 12, 31 ) // End date (December 31, 2025)
)
VAR DateTimeValues =
SELECTCOLUMNS (
GENERATE (
DateValues,
TimeValues -- 0:00 to 23:00
),
"Value", [Value] + [@Time]
)
RETURN
ADDCOLUMNS (
ADDCOLUMNS (
DateTimeValues,
"BST",
[Value] + ( 1 / 24 ) //value has been renamed the GMT column
,
"StartSunday",
VAR d =
DATE ( YEAR ( [Value] ), 3, 1 ) // Assuming March as an example
VAR r =
EOMONTH ( d, 0 ) - MOD ( WEEKDAY ( EOMONTH ( d, 0 ), 2 ), 7 )
RETURN
r,
"FinishSunday",
VAR d =
DATE ( YEAR ( [Value] ), 10, 1 ) // Assuming March as an example
VAR r =
EOMONTH ( d, 0 ) - MOD ( WEEKDAY ( EOMONTH ( d, 0 ), 2 ), 7 )
RETURN
r
),
//end of addcolumns
"DST",
IF ( [StartSunday] < [Value] && [FinishSunday] > [Value], "BST", "GMT" )
)
//end of addcolumns
Note: CROSSJOIN could also be used in place of GENERATE here.
Does this work for you?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |