Forum Discussion
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:
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!
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.
2 Replies
- AlexisOlsonSuper 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.
- CmuglioniFrequent Visitor
Hi Alexis, you were right, thank you. I made a crossjoin table between dates and hours and with your formula, it works perfect!