Forum Discussion
Summarize table with dynamic filtering
- 4 years ago
OK. We can certainly compute distances without needing an extra calculated table in the model. For example,
Closest Profile = VAR E1 = AVERAGE ( Survey[Element1] ) VAR E2 = AVERAGE ( Survey[Element2] ) VAR E3 = AVERAGE ( Survey[Element3] ) RETURN MINX ( TOPN ( 1, Profile, ( E1 - Profile[_Element1] ) ^ 2 + ( E1 - Profile[_Element1] ) ^ 2 + ( E1 - Profile[_Element1] ) ^ 2, ASC ), Profile[Profile] )You can make all this dynamic without a calculated table:
See attached.
- 4 years ago
Kudos to AlexisOlson for asking the right question to move this forward!
Rather than TopN do what you want:Avg Distance Rank = RANKX( ALLSELECTED(Profile[Profile]), [Avg Distance], , ASC, Dense )and use it in the visual filter?
bcdobbs so sorry wrong version should only be 5 tables in total I replaced the file try again and let me know if you have any issues
https://1drv.ms/u/s!Ap_eXUht9lqhhT4VlI7mT6vHYeme?e=uEQn4J
so the goal is to somehow be able to have a measure that can dynamically filter the first union Join for the brands so that the averages change based on the filter context. The second table in the union join is ok. hope this makes sense.
Really sorry I've had a look but I can't follow what you're trying to achieve.
I can see the two tables and the union join between them but they look like very different sets of data so not sure what you're trying to achieve. Can you give a numeric example of an output you would expect based on a particular filter.
- AlexisOlson4 years agoSuper User
OK. We can certainly compute distances without needing an extra calculated table in the model. For example,
Closest Profile = VAR E1 = AVERAGE ( Survey[Element1] ) VAR E2 = AVERAGE ( Survey[Element2] ) VAR E3 = AVERAGE ( Survey[Element3] ) RETURN MINX ( TOPN ( 1, Profile, ( E1 - Profile[_Element1] ) ^ 2 + ( E1 - Profile[_Element1] ) ^ 2 + ( E1 - Profile[_Element1] ) ^ 2, ASC ), Profile[Profile] )You can make all this dynamic without a calculated table:
See attached.
- bcdobbs4 years agoCommunity Champion
Kudos to AlexisOlson for asking the right question to move this forward!
Rather than TopN do what you want:Avg Distance Rank = RANKX( ALLSELECTED(Profile[Profile]), [Avg Distance], , ASC, Dense )and use it in the visual filter?
- bcdobbs4 years agoCommunity Champion
I think AlexisOlson deserves the solution on this one. I just wrapped his work in a rankx.
- AlexisOlson4 years agoSuper User
What you're asking for is a dynamic calculated table, which is not possible. So maybe you can explain what your end goal is with this table rather than defining the table as your end goal. What information are you ultimately trying to answer or visualize?
- PBI-Guy4 years agoHelper I
AlexisOlson a thanks for chiming in on this. Essentially I need to be able to some how combined the all the static values from the profile table (profile | element1 | element2 | element3) with the aggregated averages for the same three elements from the survey respondents. Without getting too much into the nitty-gritty I'm using a Euclidean distance formula that shows me the distance from the survey elements to the profile elements. An example of this would be for all the respondents in the survey under brand number one if we were to look at their three elements (which could change dynamicly based on the filtering of the question in the survey) what would the closest distance be from the profiles in the other table essentially ranking them by distance order.
- PBI-Guy4 years agoHelper I
bcdobbs ok, I understand but I will try to break it down step by step as easily as I can because I do have a hard time explaining it so here goes.
Step 1: The first table is the Survey table which is the table that has all the data for the master survey taken by various respondents. The Survey has 4 questions that have various responses.
The 3 element fields are scores for each survey respondent.
Step 2: The second table is the profile table that has static data for various user profiles. This table is not related to that Survey table but does have the same 3 element fields. However, this table is static and does not change.
Step 3: This is where I need the magic to happen the profile calculated table is the union between the profile table and the survey table to create a new profile table that now includes the summarized average for the 3 elements from the surveys table. So the final output should be a new table or measure that combines the static profile table with the 3 elements and the aggregated brand as shown in the below screenshot.
Filtering: The second thing that I need and where I am stuck is the ability to filter the Survey questions and have that filter adjust the summarized Brand elements.
I hope this helps, its difficult to explain but that is the best I can do. please let me know if you need more context.
.
- bcdobbs4 years agoCommunity Champion
Ok, starting to understand! Not sure it's statistically valid (think you'd at least need the number of respondents for each profile type).That said I'll send you an example measure later this morning that I think does what you're asking.
- PBI-Guy4 years agoHelper I
Awesome! I await your reply.
- bcdobbs4 years agoCommunity Champion
Sorry PBI-Guy I'm going to have to check out of this one. Have had another look but I just don't understand what you're trying to achieve.
AlexisOlson don't suppose you could have a look, I'm probably missing something obvious! - PBI-Guy4 years agoHelper I
AlexisOlson my goodness thanks so much! this gets me much closer now. the only issue I have is I need to plot it on a scatter chart like below.
And I also need to make the top N variable between 5-10
Thanks again Alexis
- AlexisOlson4 years agoSuper User
Top N what though? What measure does it affect (or do you just want to limit the rows showing up on the right)?
- PBI-Guy4 years agoHelper I
AlexisOlson It would affect the "closest profile" measure to limit how many rows are showing (Dynamic between 5-10).