Forum Discussion
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 be working when the segmentation is trying to affect tables that are not directly related to.
I'll give you an example: i'm made a visualization that shows how many gold, silver and bronze medals every country has. When i try to apply a date segmentation or event segmentation the visualization doesn't modify it content because in the entity relationship diagram the date table or event table are not directly related to medal table. but if i try to apply a sex segmentation (the table that has the sex column in it is directly related to the table that has information about medals) it does modify the visualization.
Do you know what's happening?
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
4 Replies
- TomMartensSuper User
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- RikiiGaitanRegular 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
- TomMartensSuper User
Hey RikiiGaitan ,
I'm not able to follow, I have difficulties to identify the date and event table in the model view.
Consider sharing the pbix, upload the pbix to OneDrive, Google Drive, or Dropbox and share the link.
Regards,
Tom
- RikiiGaitanRegular Visitor
Hi TomMartens, thanks for answering. Sure i'll share the pbix file. You might notice it's a little bit different from the pictures, thats because i translated all the fields to english. In the pictures some of them were in Spanish.
Greetings,
Riki