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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Housden996
Helper I
Helper I

Calculating an average and showing a dynamic value from a joined table

Hi

 

I have a data set where a review score out of ten is submitted and corresponds to a unique ID:

Housden996_0-1690297379715.png

I have calculated the Average of the scores and now I want to show this score agasint a corresponding table which has a ratings stored within it:

Housden996_1-1690297450541.png

I have tried to use DAX to create a measure as follows and then return the value which is assocaited but I am not having any luck:

Average Validation Score Average Grouped =
switch(
    TRUE,
        [AVG Validation Rating] = 1 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 2 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 3 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 4 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 5 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 6 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 7 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 8 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 9 , MAX('Validation Score'[Word]),
        [AVG Validation Rating] = 10 , MAX('Validation Score'[Word])
    )
 
Which fucntion should I use instead of MAX to get the associated word form the table and display this on a card?

 

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

Hi @Housden996 ,

Pleae try below dax formula:

Average Validation Score Average Grouped =
SWITCH (
    TRUE,
    [AVG Validation Rating] = 1, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 1 ),
    [AVG Validation Rating] = 2, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 2 ),
    [AVG Validation Rating] = 3, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 3 ),
    [AVG Validation Rating] = 4, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 4 ),
    [AVG Validation Rating] = 5, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 5 ),
    [AVG Validation Rating] = 6, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 6 ),
    [AVG Validation Rating] = 7, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 7 ),
    [AVG Validation Rating] = 8, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 8 ),
    [AVG Validation Rating] = 9, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 9 ),
    [AVG Validation Rating] = 10, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 10 )
)

 

Best regards,
Community Support Team_Binbin Yu
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

1 REPLY 1
v-binbinyu-msft
Community Support
Community Support

Hi @Housden996 ,

Pleae try below dax formula:

Average Validation Score Average Grouped =
SWITCH (
    TRUE,
    [AVG Validation Rating] = 1, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 1 ),
    [AVG Validation Rating] = 2, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 2 ),
    [AVG Validation Rating] = 3, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 3 ),
    [AVG Validation Rating] = 4, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 4 ),
    [AVG Validation Rating] = 5, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 5 ),
    [AVG Validation Rating] = 6, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 6 ),
    [AVG Validation Rating] = 7, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 7 ),
    [AVG Validation Rating] = 8, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 8 ),
    [AVG Validation Rating] = 9, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 9 ),
    [AVG Validation Rating] = 10, CALCULATE ( MAX ( 'Validation Score'[Word] ), 'Validation Score'[Score] = 10 )
)

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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