Forum Discussion

CornelisV's avatar
CornelisV
Icon for Helper IV rankHelper IV
1 year ago
Solved

Measure as a column for Bar chart Y axis selection

Dear all,   I have made a simple plot based on this view: When I selelect "490" from the filter, the plot must show barchart with score "A". If selected "495" , then score "B" must be visibl...
  • Ritaf1983's avatar
    1 year ago

    HI CornelisV 

    The problem occurs because there is a many-to-many relationship between 'Group table' and 'Score table'.
    This creates ambiguity when trying to sum values in a bar chart Y-axis selection, which can lead to incorrect results.

    Solution:
    To resolve this, you should introduce a bridge table that contains unique weeks, ensuring a proper relationship between the tables.
    The model should be structured as follows:

    Then you can use DAX FORMULA 

    Sum_selected_group =
    VAR selected_group = SELECTEDVALUE('Group table'[Group])
    VAR A = SUM('Score table'[A])
    VAR B = SUM('Score table'[B])
    RETURN
    IF (selected_group = 490, A, B)

    Result :

    More information about handalling eith many to many relationships here :
    https://www.youtube.com/watch?v=aPLaun-tTgQ

    The pbix is attached

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