Forum Discussion
Segmentations are not working
- 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
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
- RikiiGaitan2 years agoRegular Visitor
Hi! TomMartens. Thanks for answering.
When i first designed the database i made different tables for Weight, Height and Age because i thought that it could change the value from one game to another.
I'll do as you say and add the medals to the Olympics_Athlete table, and also i'm gonna take a look to your pbix.
Thank you again for your response. I really appreciate it.
Regards,
Riki