Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Allow Users to Override Measure Logic that Filters the Table

I have a table which matches companies based on similarity. It is constructed so that for each company, it will match against every other company, and give those matches a rank. eg.

Let's call this table 'Company Comparison'

CompanyMatched CompanyRank

A

C1

A

B2

A

D3

B

D1

B

C2

etc.

  


I then have a number of measures that, when the data is filtered on 'Company' eg. to Company A, will calculate the metric for the company matched with A at Rank 1 - so in the example above would calculate the metric for company C. The measures use the format:

CC Metric = CALCULATE([CompetitorMetric],'Company Comparison'[Rank] = 1)

What I want to do is create a slicer or similar where a business user can override this logic at will. So instead of always showing the metrics for Company C compared to A (because this is it's top match) the user could use a dropdown to say they thought A's closest competitor was B and they'd like to see the results for that instead. Ideally they could even select multiple and the competitor metrics would be for the data associated with all of those selected companies.

I'm stuck on how to acheive this. If I create a slicer on Matched Company in 'Company Comparison', the measures just won't work because the user might select a company that isn't Rank 1 and so the measure uses it's 'Company Comparison'[Rank] = 1 filter and finds no results.
 
If I try to change the measure so it looks for the highest rank remaining, instead of always rank '1' eg.
CC Metric = CALCULATE(VALUES('Company Comparison'[Competitor Metric]),FILTER('Company Comparison', 'Company Comparison'[Rank] = [Top Available Rank]))
this won't cover the multiple selection option.

Does anyone have ideas for how I might go about this?

  • Anonymous - The short form is:

     

    Measure =
      SWITCH(SELECTEDVALUE('DisconnectedTable'[Column]),
        "Option 1", <calculation one way>,
        "Option 2", <calculation a different way>
      )
    

5 Replies