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.
Hi,
I have a Time Range field like below. Please can you help me to derive Expected Flag like below. From current time to last 12 hours need to flag it as Last 12 hours else >Last 12 hours.
Time Range Expected Flag
Wed, 15 Feb 2023 07:51:22 Last 12 hours
Wed, 15 Feb 2023 06:20:26 Last 12 hours
Tue, 14 Feb 2023 15:23:35 >Last 12 hours
I have tried below logic
Solved! Go to Solution.
@paw2 You could try using DATEDIFF:
Flag =
VAR _HoursDiff =
DATEDIFF( MAX( 'Table1'[Time Range] ) , NOW(), HOUR)
RETURN
SWITCH( TRUE(),
_HoursDiff >= 12, "> Last 12 hrs",
_HoursDiff >= 0, "Last 12 Hours",
"Future Time"
)
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@paw2 You could try using DATEDIFF:
Flag =
VAR _HoursDiff =
DATEDIFF( MAX( 'Table1'[Time Range] ) , NOW(), HOUR)
RETURN
SWITCH( TRUE(),
_HoursDiff >= 12, "> Last 12 hrs",
_HoursDiff >= 0, "Last 12 Hours",
"Future Time"
)
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
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 |
---|---|
110 | |
109 | |
89 | |
76 | |
66 |
User | Count |
---|---|
126 | |
112 | |
99 | |
82 | |
73 |