Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply

Use/ capture selected value from a filter and use it in a New column

Hello,

I have been trying to show whether the device is online/offline based on it's last response time. I have created a new column with logic as, if the device's last response is within 2 hours then it's online and everything else is offline.

 

Here i want to make the 2 hours window as dynamic, user can pick between 1-24 hours and the logic should be 

if the device's last response is within <user selected> hours then it's online and everything else is offline.

 

if(device[devicelastresponsetime]>(UTCNOW()-TIME(selectedvalue),0,0)),"Online","Offline")
this returns blank as SELECTEDVALUE() is blank. Though as a measure this works perfectly
sharmisaranga09_0-1708950460124.png

 

 

5 REPLIES 5

I am able to get a measure working,

On/OffStatus = if(SELECTEDVALUE(device[lastresponsetime])>(UTCNOW()-TIME(SELECTEDVALUE(Parameter[Parameter]),0,0)),"Online","Offline")

Thank you.

Anonymous
Not applicable

Hi  @sharmisaranga09 ,

 

Does the above dax formula solve your problem, and if it doesn't meet your expected results, can you share sample data and sample output in tabular format? Or sample pbix after removing sensitive data. We can understand the problem better and help you.

 

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.

Hi, 

I couldn't attach pbix due to permission issue, Here is the sample I captured. DateTime is in UTC.

sharmisaranga09_0-1709013862790.png

 

Hi, Thank you.
I have multiple devices with single devicelastresponsetime value each, this gets updated whenever new response receives.
I still get all the values as offline eventhough I have chosen higher parameter value from your pbix report.
were you able to get the changes for selected value from slicer or have you used default value in parameter configuration?

sharmisaranga09_0-1709011480997.png

 

 

Anonymous
Not applicable

Hi  @sharmisaranga09 ,

 

Here are the steps you can follow:

 

If you have more than one device, you can use the following dax.

Create measure

Group_date =
var _maxdate= MAXX(FILTER(ALL('device'),'device'[device_name]=MAX('device'[device_name])),[devicelastresponsetime])
var _hour=DATEDIFF(_maxdate,NOW(),HOUR)
return
IF(
    _hour=SELECTEDVALUE('Parameter'[Parameter]),"Online","Offline")

vyangliumsft_0-1708998150943.png

If you have a device, you can use the following dax.

Create measure

Single_date =
var _maxdate= MAXX(ALL('device'),[devicelastresponsetime])
var _hour=DATEDIFF(_maxdate,NOW(),HOUR)
return
IF(
    _hour=SELECTEDVALUE('Parameter'[Parameter]),"Online","Offline")

vyangliumsft_1-1708998150944.png

 

 

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.