Forum Discussion

ThomasDay's avatar
ThomasDay
Impactful Individual
7 years ago
Solved

Changing the Selection within Calculate()

Hello all,   I have prepared a compressed model that can help anyone see what I'm doing and perhaps help me get to an answer.   I pick a group of Comparison facilities using a slicer...and comput...
  • d_gosbell's avatar
    7 years ago

    The issue here that that you are generating conflicting filters on the 'data table' table. If you exclude Government from the Comparison Providers, but then select a Scorecard provider that only contains data for Government you end up filtering out all the rows in 'Data Table'.

     

    If the behaviour that you want is for the scorecard measures to ignore the comparison provider selection, the you could do this by wrapping your scorecard measures with another CALCULATE() and use the CROSSFILTER() function to "turn off" the relationship. 

     

    Note: you will need to do this for both [Scrd Price Per Unit] and [Tot Scrd Cases]

     

    eg

     

     

    Scrd Price Per Unit = CALCULATE(
    CALCULATE(
    AVERAGE('DataTable'[Price per Unit]), FILTER('DataTable', 'DataTable'[ProviderID] = SELECTEDVALUE(ScorecardProvider[ProvdrID]))
    ) ,CROSSFILTER('ComparisonProviders'[ProvdrNo], 'DataTable'[ProviderID], None) )

     

     

    Tot Scrd Cases = CALCULATE(
    CALCULATE(
    SUM('DataTable'[TotalUnits]), FILTER('DataTable', 'DataTable'[ProviderID] = SELECTEDVALUE(ScorecardProvider[ProvdrID]))) ,CROSSFILTER(ComparisonProviders[ProvdrNo], 'DataTable'[ProviderID], None)
    )