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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PolAmer
Frequent Visitor

Checking for 3 consecutive temps of 20 and under

I have a table with dates and Avg temps which update multiple times a day. I'm trying to highlight the Avg. Temp cells only when 3 consecutive dates have temparatures of 20 degrees or lower. Is there a way in PowerBI to acomplish this? 
 
Original Data

DateAvg Temp
2/10/2025        20
2/11/2025        22
2/12/2025        19
2/13/2025        29
2/14/2025        21
2/15/2025        20
2/16/2025        18
2/17/2025        7
  

 

Final Result

DateAvg Temp
2/10/2025        20
2/11/2025        22
2/12/2025        19
2/13/2025        29
2/14/2025        21
2/15/2025      20
2/16/2025      18
2/17/2025       7
5 REPLIES 5
GiuseppeMR
Frequent Visitor

Hi,

Do you expect the following result?

GiuseppeMR_0-1739436618678.png

If so, try this approch:

  • define the measure Check:

 

check = 
if(
    [sum val] = 20 && 
    calculate(
        [sum val], 
        DATEADD(Tabella[date], 1, DAY) )<20 &&
    calculate(
        [sum val], 
        DATEADD(Tabella[date], 2, DAY) )<20 ,
    "ok",
    "ko"
    )

 

  • define a metric color:

 

color = 
if(
    [check] = "ok", 1,
    if(
        CALCULATE([check], DATEADD(Tabella[date], -1, DAY)) = "ok" ||
        CALCULATE([check], DATEADD(Tabella[date], -2, DAY)) = "ok",
        1, 0))

 

  • define the conditional formatting on your measure:

GiuseppeMR_1-1739436912757.png

 

Note: this approch should work if all dates are consecutive

Hi GiuseppeMR,
I've updated my origianl message. Your measure check did not work for me.

ToddChitt
Super User
Super User

Ah, so if I understand you correctly now, it has to be three days in a row below 20, not just any ONE day below 20, correct?

If so, you should investigate Visual Calculation, and create a DAX calc at the Visual Level that is the MAX of the last three days. But I'm not sure how you would get the formatting to be right for the 15th as the MAX for the last three days on the 15 would be 29.

 

Let me ask this: What is the problem you are trying to solve? It may not be exact, but a rolling average may be close. FYI, that is also available in Visual Calculations DAX.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





PolAmer
Frequent Visitor

Hi ToddChitt,
I'm don't see an function in Conditional Fromatting that would check for 3 consecutive 20 and lower integers and then highlight them. 

ToddChitt
Super User
Super User

In the Fields section, click the optons next to the field you want to format (in this case, [Ave Temp]) and select "Conditional Formatting" and follow the prompts.

ToddChitt_0-1739391368616.png

 




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors