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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Weekly attendance, average and week on week change

I have data for a weekly event, held on the same day each week.  My data has a Date, Location & Count field which represents the count of people in attendance for that week/date for a particular location, and the data spans accross 2 years.

 

I have added columns for year, month, monthname & weeknum.

 

  1. I want to see average attendance per week for each location.
  2. I want to see weekly attendance change week by week

Please help.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Sorry for late back, you can modify the formula to:

Weekly Change =
VAR _Current =
    SUMX (
        FILTER (
            'Table',
            'Table'[WeekNum] = EARLIER ( 'Table'[WeekNum] )
                && 'Table'[Location] = EARLIER ( 'Table'[Location] )
        ),
        'Table'[Count]
    )
VAR _Next =
    SUMX (
        FILTER (
            'Table',
            'Table'[WeekNum]
                = EARLIER ( 'Table'[WeekNum] ) + 1
                && 'Table'[Location] = EARLIER ( 'Table'[Location] )
        ),
        'Table'[Count]
    )
RETURN
    DIVIDE ( _Next - _Current, _Current )

Best Regards,
Community Support Team _ kalyj

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
Anonymous
Not applicable

Thank you @v-yanjiang-msft that looks pretty clear and straight forward.  

 

What's the difference between finding an average using your measure and simply dropping the Count column in a visual and selecting to summarise it by Average?

 

Also I know there are always many ways to do what I need  so I welcome someone else to provide another approach, for my reference.

Hi @Anonymous ,

My pleasure!

If your data is just the same with my sample, there's no difference. The formula can ensure not be affected by slicer etc.

 

Best Regards,
Community Support Team _ kalyj

v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample and add a weeknum column. Date column are saturdays from each week.

vkalyjmsft_0-1665026036824.png

Here's my solution.

1.Average attendance per week for each location. Create a measure.

Average Count =
AVERAGEX (
    FILTER ( ALL ( 'Table' ), 'Table'[Location] = MAX ( 'Table'[Location] ) ),
    'Table'[Count]
)

Put Location and the measure in a visual, get the result.

vkalyjmsft_1-1665026187347.png

2.Attendance change week by week. Create a calculated column.

Weekly Change =
VAR _Current =
    SUMX (
        FILTER ( 'Table', 'Table'[WeekNum] = EARLIER ( 'Table'[WeekNum] ) ),
        'Table'[Count]
    )
VAR _Next =
    SUMX (
        FILTER ( 'Table', 'Table'[WeekNum] = EARLIER ( 'Table'[WeekNum] ) + 1 ),
        'Table'[Count]
    )
RETURN
    DIVIDE ( _Next - _Current, _Current )

Get the result.

vkalyjmsft_2-1665026285100.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

Anonymous
Not applicable

Hi again, this is good and i have added this in, however each location needs to have their own week 1,2,3 etc, like this.

 

Datelocationcountweeknum
1/1/22A91
1/1/22B181
1/1/22C101
1/8/22A62
1/8/22B202
1/8/22C202
1/15/22A83
1/15/22B53
1/15/22C93
1/22/22A84
1/22/22B154
1/22/22C114
1/29/22A155
1/29/22B55
1/29/22C205

 

What adjustments are needed to work with this data structure?

Hi @Anonymous ,

Sorry for late back, you can modify the formula to:

Weekly Change =
VAR _Current =
    SUMX (
        FILTER (
            'Table',
            'Table'[WeekNum] = EARLIER ( 'Table'[WeekNum] )
                && 'Table'[Location] = EARLIER ( 'Table'[Location] )
        ),
        'Table'[Count]
    )
VAR _Next =
    SUMX (
        FILTER (
            'Table',
            'Table'[WeekNum]
                = EARLIER ( 'Table'[WeekNum] ) + 1
                && 'Table'[Location] = EARLIER ( 'Table'[Location] )
        ),
        'Table'[Count]
    )
RETURN
    DIVIDE ( _Next - _Current, _Current )

Best Regards,
Community Support Team _ kalyj

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors