Forum Discussion

RikiiGaitan's avatar
RikiiGaitan
Regular Visitor
2 years ago
Solved

Segmentations are not working

Hi! how are you all doing? I'm currently trying to make a dashboard about the Olympics games with a dataset i've got. The thing is i'm trying to apply some segmentations to it but they don't seem to ...
  • TomMartens's avatar
    2 years ago

    Hey RikiiGaitan ,

     

    There are a couple of ways to optimize the semantic model. For example, height is information that belongs to the athlete table and not to a separate table. The same should be true for weight, except you want to analyze an athlete's performance dependent on the weight measured during the different events.

     

    I would also suggest that you add the medal (bronze, silver, gold, or null to the Olympics_Athlete table, otherwise it's not clear when an anthlete won a medal.

     

    Nevertheless, this is how the model looks like (see the layout page "simplified") i used to create a measure that reflects on selections in calendar table:

    The measure looks like this:

     

     

    # of medals = 
    CALCULATE(
        COUNT( 'Athlete_Medal'[ID_Medal] )
        , CROSSFILTER( Athlete[ID_Athlete] , Olympics_Athlete[ID_Athlete] , Both)
        ,CROSSFILTER( 'Medalla'[ID_Medal] , 'Athlete_Medal'[ID_Medal] , Both)
    )

     

     

    The table on the right is "dependent" on the selected yeaars:

     

    Here you will find my pbix: https://tommartens-my.sharepoint.com/:u:/g/personal/tom_minceddata_com/EdUUlw6aqoRGgC6mBZ5rgwoB93bZ2A9ULDBpn_C9rWf9zQ?e=gJVdkH

     

    The problem is that the measure did not consider the Calendar table: it is not directly related. I also had to use CROSSFILTER to change the filtering from the many sides of a relationship to the one side of a relationship.
    I used CROSSFILTER for doing this. In general, it is considered best practice to use CROSSFILTER for changing the filter direction of a relationship, than enabling cross filter direction in the model.

     

    Hopefully, this provides what you are looking for.

    Regards,
    Tom