Forum Discussion

dphillips's avatar
dphillips
Icon for Helper IV rankHelper IV
2 years ago
Solved

Measure using filters on fields from related table

I have a 'Students' table which has a unique set of students. The fields include a StudentID, Name, Yearlevel, MentorGroup and Fileyear. I then have a related table called 'Merits' which has all the ...
  • gmsamborn's avatar
    gmsamborn
    2 years ago

    Hi dphillips 

     

    Would these measures help?

    Avg = 
        AVERAGEX(
            FILTER(
                ALL( 'Student' ),
                'Student'[Fileyear] = MAX( 'Student'[Fileyear] )
                    && 'Student'[YearLevel] = MAX( 'Student'[YearLevel] )
            ),
            [TotalMeritsThisYear]
        )
    
    
    
    MaxStudent = 
        MAXX(
            FILTER(
                ALL( 'Student' ),
                'Student'[Fileyear] = MAX( 'Student'[Fileyear] )
                    && 'Student'[YearLevel] = MAX( 'Student'[YearLevel] )
            ),
            [TotalMeritsThisYear]
        )

     

    On Page 2, you'll notice that [Avg] and [MaxStudent] change as [YearLevel] changes.  Also, you can compare the numbers to those on Page 1 where you can set slicers.

     

    TestMerits-3.pbix