Forum Discussion
StefanM
5 years agoHelper II
Help! Relative Time Filter - Between Hours
Hi guys, I have a table with a column of Date-Time. I need to use that column to filter charts between recent hours. For example: Past 5 hours, 5-24 hours, 24-72 hours, etc I can't see any way t...
- Anonymous5 years ago
Hi StefanM ,
Here are the steps you can follow:
1. Create calculated column.
Hour = DATEDIFF(MAX('Table'[date]),NOW(),HOUR)Hour_Column = var _1=DATEDIFF('Table'[date],NOW(),HOUR) return SWITCH( TRUE(), _1>0&&_1<=5,"0-5", _1>5&&_1<=24,"5-24", "24-72")2. Create measure
count of resopnse = CALCULATE(COUNT('Table'[Legend]),FILTER('Table','Table'[Legend]=MAX('Table'[Legend])))3. Place Hour_Column in Axis, Legend in Legend, and count of resopnse in Values
4. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
5 years agoNot applicable
Hi StefanM ,
Here are the steps you can follow:
1. Create calculated column.
Hour =
DATEDIFF(MAX('Table'[date]),NOW(),HOUR)Hour_Column =
var _1=DATEDIFF('Table'[date],NOW(),HOUR)
return
SWITCH(
TRUE(),
_1>0&&_1<=5,"0-5",
_1>5&&_1<=24,"5-24",
"24-72")2. Create measure
count of resopnse =
CALCULATE(COUNT('Table'[Legend]),FILTER('Table','Table'[Legend]=MAX('Table'[Legend])))3. Place Hour_Column in Axis, Legend in Legend, and count of resopnse in Values
4. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.