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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Jozef13
Frequent Visitor

Distinct Count of Total Averages

Hello everyone,
I have a spreadsheet with temperature records from several loggers.
I need to find out how many loggers have an average temperature above a certain value (temperature rounded down without decimals).
I can calculate this using a combination of a pivot table and Excel formulas, but I can't create a calculated field or measure in the pivot table (PowerPivot) that would do this automatically and of course dynamically based on the filters and slicers used, as you can see in the attached file.

Distinct Temp.xlsx 

10 REPLIES 10
Jozef13
Frequent Visitor

The certain value or values is a list with the average temperatures of all loggers rounded down without decimals (integers) in my file labeled as "BaseTemp".
I need to find out how many loggers have an average temperature above 20°C (20<=AVGTemp<21), than 21°C (21<=AVGTemp<22), etc.
Currently I have a pivot table of average temperatures + a helper column of rounded down values, and a table that counts the occurrences of each temperature in the helpere column.
And I want to automate all this and have it in one resulting pivot table.

Jozef13_0-1711617454027.png

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Hello,

I apologise for my description. I probably expressed myself inaccurately.

Sample data is in linked file "Distinct Temp.xlsx" Sheet name: Data

The expected result is on the "PowerPivot" sheet, where is my actual procedure with the helper column and the resulting FinalTable.
My goal is to create a Pivot table with the same results as in the FinalTable, which will be dynamically recalculated according to the applied filters (slicers).

 

Distinct Temp.xlsx 

Note: a comma is used as the decimal separator in the spreadsheet.

Power BI does not have a concept of dynamic buckets.  You need to bring your own.

 

lbendlin_0-1711641025478.png

 

Your table shows the number of records in the [Sensor No] column that match the list of unique temperatures from the [Temperature (int)] column.
If I change Number of Sensors to Number of Sensors (Distinct), I get the number of sensors with the corresponding temperature, but from the [Temperature (int)] column, where the values are already rounded down.
What I need are the total average temperatures of the individual sensors from the [Temperature (°C)] column, which are then rounded down without decimals, and only from these values I determine the number of sensors (distinct count) whose value is above the relevant temperature (list of unique temperatures in the [Temperature (int)] column

Is it possible to do this using DAX?Distinct Count.jpg

if a sensor is above 17 then it is also above 13, no?

Yes, you're right.
But I expect a number of temperature values between integers (i, i+1).
I.e. average temperature above 20°C but less than 21°C (20<=AVGTemp<21),

above 21°C but less than 22°C (21<=AVGTemp<22), etc.

That's then back to your buckets. Not really sure what you are asking for.

I probably can't describe it better than on the "PowerPivot" sheet in my xlsx file.
There is a functional calculation using the pivot table and standard Excel functions.

Distinct Temp_R1.xlsx 

lbendlin
Super User
Super User

What is your "certain value" ?

 

lbendlin_0-1711584369931.png

 

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.