Forum Discussion
Help with graphing
- Anonymous6 years ago
Hi,
After trying some things i came up with a solution, I don't know if it's the best possible solution, but it seems to work for me.
First i added a new custom column to your existing table with managers, with all values being "all"
ifnotfiltered = "all"Then I created a new table, with all the distinct managers and an extra row for "all":
filtertable = UNION(CALCULATETABLE(DISTINCT('Table'[manager])); ROW("manager"; "all"))Then in the model window i created two relationships:
- 'filtertable'[manager] > 'Table'[Manager]
- 'filtertable'[manager] > 'Table'[ifnotfiltered]
Then create a measure that checks if the manager is filtered or not, if there is a filter we use the regular relationship, else we use the second relationship where the manager is "all"
isfiltered = if(ISFILTERED('Table'[manager]); CALCULATE(SUM('Table'[value]) ; USERELATIONSHIP('Table'[manager]; filtertable[manager])) ;CALCULATE( SUM('Table'[value]); USERELATIONSHIP('Table'[ifnotfiltered]; filtertable[manager])))
Use this measure as the Values of your charts. & it should be working.note: Due to my regional settings I use ' ; ' instead of ' , ' so maybe you need to change the semicolons to comma's in your measures
Hi,
After trying some things i came up with a solution, I don't know if it's the best possible solution, but it seems to work for me.
First i added a new custom column to your existing table with managers, with all values being "all"
ifnotfiltered = "all"
Then I created a new table, with all the distinct managers and an extra row for "all":
filtertable = UNION(CALCULATETABLE(DISTINCT('Table'[manager])); ROW("manager"; "all"))
Then in the model window i created two relationships:
- 'filtertable'[manager] > 'Table'[Manager]
- 'filtertable'[manager] > 'Table'[ifnotfiltered]
Then create a measure that checks if the manager is filtered or not, if there is a filter we use the regular relationship, else we use the second relationship where the manager is "all"
isfiltered = if(ISFILTERED('Table'[manager]); CALCULATE(SUM('Table'[value]) ; USERELATIONSHIP('Table'[manager]; filtertable[manager])) ;CALCULATE( SUM('Table'[value]); USERELATIONSHIP('Table'[ifnotfiltered]; filtertable[manager])))
Use this measure as the Values of your charts. & it should be working.
note: Due to my regional settings I use ' ; ' instead of ' , ' so maybe you need to change the semicolons to comma's in your measures