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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.