Forum Discussion

Yonah's avatar
Yonah
Icon for Helper II rankHelper II
1 year ago
Solved

Ignore selection of certain value

On my report page, I have a bar chart with different countries and a total column. I did this via ‘All_Countries_Plan = UNION(Distinct(Account[Country]),{’Gesamt"})’ Where ‘Gesamt’ = Total....
  • danextian's avatar
    1 year ago

    Hi  Yonah 

     

    Measures must always return a scalar value one way or another.  These two return a table with multiple values.

    ALL(‘All_Country_Plan’)
    
    VALUES(‘All_Country_Plan’))

     

    I am not sure what exactly you're trying to calculate but this is the correct use:

    IF (
        -- Check if the selected country is "Total"
        SELECTEDVALUE ( 'All_Country_Plan'[Country] ) = "Total",
        -- If "Total" is selected, calculate the measure ignoring all filters on 'All_Country_Plan'
        CALCULATE (
            [my measure],
            ALL ( 'All_Country_Plan' )
        ),
        -- Otherwise, return the measure as is, keeping existing filters
        [my measure]
    )