Forum Discussion

newhopepdx's avatar
newhopepdx
Resolver I
1 year ago
Solved

Confusing Averages

I just can't seem to wrap my head around averaging when slicing!

 

The measures in the demo.pbix (https://www.dropbox.com/scl/fi/iuj5d8rkzmfl7yoayg41e/Demo.pbix?rlkey=lkergwyytvgekzl8aoenfkjmg&st=vwfp3a2h&dl=0) all work as long as only one item is selected in the slicer that corresponds to that field. But when more than one field is selected it groups each slicer selection separately and then averages.

 

In the example, Average x Event & x GroupTyper are correct, but x Venue is not as its used 6 entries for Venue A & 6 entries for Venue B and divided by 12, instead of 6.

 

What's the proper measure(s) to obtain the average that reflects the condition set by all four slicers?

 

  • newhopepdx If you only want 6 entries then you don't SUMMARIZE by both date and venue, you would just use date. Also, your DAX is really odd in terms of how you hae constructed it.

    Average x Venue 2 = 
        VAR __Table = SUMMARIZE(AttendanceData,AttendanceData[Date], "Attendance", [Attended])
        VAR __Result = AVERAGEX( __Table, [Attendance] )
    RETURN
        __Result

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    newhopepdx If you only want 6 entries then you don't SUMMARIZE by both date and venue, you would just use date. Also, your DAX is really odd in terms of how you hae constructed it.

    Average x Venue 2 = 
        VAR __Table = SUMMARIZE(AttendanceData,AttendanceData[Date], "Attendance", [Attended])
        VAR __Result = AVERAGEX( __Table, [Attendance] )
    RETURN
        __Result