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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Cmuglioni
Frequent Visitor

Problem with COUNTROWS and TOTALS

Hi Everyone, I have the following issue:

 

My objective: I have 3 different weather stations that give me the temperature hourly. I am looking to count each hour when the temperature is going below 0.

 

What i have done: I have succeed to create a measure that count every time when the temperature is below 0 using this formula:

 

Medida = CALCULATE(COUNTROWS('BD Estación meteo'),'BD Estación meteo'[T° del aire HC [°C]] Min]<0)
 
and I have the following results:

 

Cmuglioni_0-1638303615158.png

 

My problem: I have an issue with the totals (last two columns) it should show me 1/1/1  instead of 1/3/2 and the total should be 3.

 

Any tips or advices?

 

Thanks in advance! 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

You need to count at the appropriate granularity.

 

If your date table is at the day-hour granularity, then you can probably write something like this:

COUNTROWS (
    FILTER ( dimDate, CALCULATE ( MIN ( 'BD Estación meteo'[T° Min] ) ) < 0 )
)

 

If your dates and hours aren't both from the same date table (where hour is the deepest level of granularity), then this will need to be adjusted accordingly.

View solution in original post

2 REPLIES 2
Cmuglioni
Frequent Visitor

Hi Alexis, you were right, thank you. I made a crossjoin table between dates and hours and with your formula, it works perfect!

AlexisOlson
Super User
Super User

You need to count at the appropriate granularity.

 

If your date table is at the day-hour granularity, then you can probably write something like this:

COUNTROWS (
    FILTER ( dimDate, CALCULATE ( MIN ( 'BD Estación meteo'[T° Min] ) ) < 0 )
)

 

If your dates and hours aren't both from the same date table (where hour is the deepest level of granularity), then this will need to be adjusted accordingly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.