How to Create a DAX Measure to Detect Temperature Differences Over 6 Hours
Question details
The user needs a DAX expression to determine if the current temperature is within one degree of the set point and to count records that have failed to reach the set point for more than six hours.

- Product
- Excel / Power BI
- Device & OS
- not provided
- Scenario
- Analyzing IoT or device temperature logs to identify anomalies where a system fails to reach its target temperature for an extended period of time.
- Observed behavior
- Requires a formulated DAX expression to evaluate row-level or context-level temperature thresholds and elapsed time differences.
Ensure your data model contains a table (e.g., HeatSense_Device) with valid numerical columns for SetPointTemp and CurrentTemp, and a datetime column for UpdatedOn.
Create a DAX Measure for Temperature Status and 6-Hour Delay Count
Use a combination of logical IF, ABS, and FILTER functions in DAX to evaluate temperature differences and time elapsed.
To solve this, the problem must be broken into two parts: first, determining if the target temperature has been reached, and second, counting the instances where it hasn't been reached for over six hours.
The exact formula structure depends on your evaluation context, such as whether you are calculating this per specific device, per row, or across the entire report dataset.
Define a measure to check if the temperature is within one degree of the set point. In your DAX formula bar, enter: SetPointReached = IF(ABS(AVERAGE(HeatSense_Device[SetPointTemp]) - AVERAGE(HeatSense_Device[CurrentTemp])) < 1, 1, 0)
Use the CALCULATE and FILTER functions to count the delayed records. Since DAX handles dates as numbers where 1 equals a full day, 6 hours is represented as 6/24. Enter the formula: DelayedRecords = CALCULATE(COUNTROWS(HeatSense_Device), FILTER(HeatSense_Device, ABS(HeatSense_Device[SetPointTemp] - HeatSense_Device[CurrentTemp]) >= 1 && HeatSense_Device[UpdatedOn] < NOW() - (6/24)))
Add your newly created measures to a Table or Matrix visual. If you are calculating this per device, ensure your visual includes the 'Device ID' column so the measure accurately evaluates within the correct filter context for each machine.

Need to handle complex data analysis? Try WPS Office
While DAX measures are specific to Microsoft's Power Pivot and Power BI environments, WPS Office Spreadsheet provides a robust, lightweight, and completely free alternative for standard data analysis. With advanced PivotTables, comprehensive built-in formulas, and seamless compatibility with Microsoft Excel files, you can perform deep data modeling without heavy resource requirements.
- 1. Download and install: Download WPS Office for free from the official website and install it on your device.
- 2. Open your dataset: Launch WPS Spreadsheet and open your existing Excel data files containing your temperature logs.
- 3. Analyze the data: Navigate to the 'Data' tab to utilize extensive built-in functions, conditional formatting, and PivotTables to evaluate temperature differences and time thresholds.

Frequently Asked Questions
Can I use DAX functions in standard Excel without Power Pivot?
No, DAX (Data Analysis Expressions) is specifically designed for the Power Pivot data model and Power BI. For standard Excel or WPS Spreadsheet, you must use standard formula equivalents like IF, AVERAGE, and COUNTIFS.
How does DAX handle time calculations like 'six hours ago'?
In DAX, dates and times are stored as floating-point numbers where one day equals 1.0. To subtract six hours from the current time, you subtract the fraction of the day, which is calculated as 6/24 (or 0.25).
Why does my DAX measure return an error about 'multiple columns'?
This usually happens when a measure references a column directly without an aggregator (like SUM, AVERAGE, or MAX) outside of a row context. You must use iterator functions like FILTER or SUMX to evaluate logic row-by-row.
What is the difference between NOW() and TODAY() in DAX?
The NOW() function returns the current date and the precise current time, whereas TODAY() returns the current date with the time set exactly to 12:00:00 AM. For tracking a rolling six-hour window, you must use NOW().




