Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I want to return the seconds starting the count from 07:00am without restarting the count after every 60 seconds
So the results should look like this
Solved! Go to Solution.
Check this one..
I just used time default time as 7:50:10 to test the Dax code. You can change it to 7:00:00
_Counter =
var _defaultime = TIME(7,50,10)
return
IF('Table'[Time] >_defaultime,
DATEDIFF(_defaultime,'Table'[Time],SECOND),
BLANK()
)
Hi @Anonymous ,
Since there are multiple conditions based on time 07:00:00(>, < , =), and you used DATEDIFF() twice with the same experssion, you could use a variable and SWITCH() to simplify the syntax:
_Counter =
VAR _defaultime = TIME (7, 00, 00 )
VAR _diff = DATEDIFF ( _defaultime, muchData_MultipleBelts[Time], SECOND )
RETURN SWITCH (TRUE (),[Time] > _defaultime, _diff,[Time] < _defaultime,( 60 * 60 * 24 ) + _diff,BLANK ())
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check this one..
I just used time default time as 7:50:10 to test the Dax code. You can change it to 7:00:00
_Counter =
var _defaultime = TIME(7,50,10)
return
IF('Table'[Time] >_defaultime,
DATEDIFF(_defaultime,'Table'[Time],SECOND),
BLANK()
)
I changed your dax code so at 00:00:00 the count of seconds continue untill 7:00:00
_Counter =
var _defaultime = TIME(7,00,00)
return
IF(muchData_MultipleBelts[Time] >_defaultime,
DATEDIFF(_defaultime,muchData_MultipleBelts[Time],SECOND),
IF(muchData_MultipleBelts[Time] < _defaultime,
(60*60*24) + DATEDIFF(_defaultime, muchData_MultipleBelts[Time], SECOND),
BLANK()
))
Can you check if its correct? I mean it works but maybe there is a better way
Hi, Looks good.
@Anonymous create this calculated column and make it a whole number / decimal number date type:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
103 | |
77 | |
66 | |
63 |
User | Count |
---|---|
142 | |
105 | |
102 | |
81 | |
68 |