Forum Discussion

zohebakber's avatar
zohebakber
Cloud Apps
08-28-2023
Solved

Calculate and compare selected member to non-selected members

Calculate and compare selected member to non-selected members Hello, In the screenshot below, I want one bar for the selected dashboard filter and the purple bar for the rest(non selected) aggr...
  • wallingfordce's avatar
    08-28-2023

    It's not pretty, but you could do a CASE statement if the list of countries isn't changing too much...

    CASE
    WHEN [Total of Something] = ( [Total of Something] , [Country = India] )
    THEN ( [Total of Something] , [Country <> India] )
    WHEN [Total of Something] = ( [Total of Something] , [Country = US] )
    THEN ( [Total of Something] , [Country <> US] )
    ETC. END

    Or if you have both a Country field and a Country ID field, and the Country description is on Categories, then you can get more exacting (the above could throw bad results if 2 countries have the same [Total of Something].

    CASE WHEN [Max Country ID] = {hard-coded Country ID of India}
    THEN ( [Total of Something] , [Country <> India] )
    ETC. END

    Otherwise, I'd be eager to hear of others' tricks for getting a formula filter to more dynamically adjust in response to the category grouping or higher-level filter changes.

  • irismaessen's avatar
    08-28-2023

    If it's totals or counts you're calculating (this doesn't work with averages unless you calculate them yourself from counts/sums), I wonder if you can't have two formulas, one of which is 
    Formula 1: [Total of Something] 
    Formula 2: ([Total of Something], ALL(Country)) - [Total of Something]


    You can still combine this with filters on region/country on the dashboard itself by duplicating the 'Country' column and using one column in the dashboard filter and one in the widget
    If you have no filter on Country, Formula 2 will be 0, but if there *is* a filter on Country, you should see values for Formula 1 *and* Formula 2