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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jaeshin2
Frequent Visitor

SUM of values grouped by hour

Hello,

I have data with multiple same values. I need to do SUM of all the values based on DISTICT value of another column.

 

my daya look like this: 

DateHourHour AFloor CodeSensor#Boardroom CapacitySq FtDepartmentPlaceAverage Zone Count
1/8/2020 0:0099 AM48th_floorr3103614453Boardroomarea3616
1/8/2020 0:001010 AM48th_floorr3103614453Boardroomarea3614
1/8/2020 0:001010 AM48th_floorr3103614453Boardroomarea3614
1/8/2020 0:001010 AM48th_floorr3103614453Boardroomarea3614
1/8/2020 0:0099 AM48th_floorr3103614453Boardroomarea3616
1/8/2020 0:0099 AM48th_floorr3103614453Boardroomarea3616
1/8/2020 0:001010 AM48th_floorr3103614453Boardroomarea3614
1/8/2020 0:0099 AM48th_floorr3103614453Boardroomarea3616
1/8/2020 0:0099 AM48th_floorr3103614453Boardroomarea3616
1/8/2020 0:001111 AM48th_floorr3103614453Boardroomarea3615
1/8/2020 0:001111 AM48th_floorr3103614453Boardroomarea3615
1/8/2020 0:001111 AM48th_floorr3103614453Boardroomarea3615
1/8/2020 0:001111 AM48th_floorr3103614453Boardroomarea3615

 

As you can at 9 hour for sensor r31036 and for date 1/8/2020, I have 5 rows with same value for Average Zone Count.

so at 9 AM - value is 16

at 10 AM - value is 14

at 11 AM - value is 15

 

How do I sum all this values so that I get 14 + 15 + 16 = 45 in a measure? 

I guess I need to group by Date, Hour, Sensor# and SUM (Average Zone Count)

Expected measured value: 14 + 15 + 16 = 45

Your help is much appricated! 

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @jaeshin2 

For your case, just use this measure:

Measure = SUMX(VALUES('Table'[Hour]),CALCULATE(AVERAGE('Table'[Average Zone Count])))

or

Measure 2 = SUMX(SUMMARIZE('Table','Table'[Date],'Table'[Hour]),CALCULATE(AVERAGE('Table'[Average Zone Count])))

Result:

5.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

hi @jaeshin2 

For your case, just use this measure:

Measure = SUMX(VALUES('Table'[Hour]),CALCULATE(AVERAGE('Table'[Average Zone Count])))

or

Measure 2 = SUMX(SUMMARIZE('Table','Table'[Date],'Table'[Hour]),CALCULATE(AVERAGE('Table'[Average Zone Count])))

Result:

5.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
harshnathani
Community Champion
Community Champion

Hi @jaeshin2 ,

 

 

Measure  = CALCULATE (SUM ('Table'[Average Zone Count]), ALLEXCEPT ( 'Table', 'Table' [Hour]))

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

This measure gives me very large number. I thinks its summing up all the records? 

I needed to do per date, per hour, per sensor#. 

 

so I tried  

Measure = CALCULATE (SUM ('ZoneSensors Summary'[Boardroom Average Zone Count]), ALLEXCEPT ('ZoneSensors Summary', 'ZoneSensors Summary'[Date], 'ZoneSensors Summary'[Hour], 'ZoneSensors Summary'[Sensor#]))
 
Still giving me very large number. 

Hi @jaeshin2 ,

 

Try this

 

Measure =
CALCULATE (
    SUM ( 'ZoneSensors Summary'[Boardroom Average Zone Count] ),
    FILTER (
        ALL ( 'ZoneSensors Summary' ),
        'ZoneSensors Summary'[Date]
            = MAX ( 'ZoneSensors Summary'[Date] )
            && 'ZoneSensors Summary'[Hour]
                = MAX ( 'ZoneSensors Summary'[Hour] )
            && 'ZoneSensors Summary'[Sensor#]
                = MAX ( 'ZoneSensors Summary'[Sensor#] )
    )
)

 

 

Else please share the expected output.

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

Please see updated questions with some more clarty and expected output.

Thanks 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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