Forum Discussion

zoffice's avatar
zoffice
Helper I
5 years ago
Solved

Default filter when no filter selected

Hi all,

 

I have a slicer of list of regions, and some table and graphs showing the indicators for each selected region.

For example, one card showing some country background text, and another visual showing the population.

 

The regions are Asia, Africa, Europe, etc.

 

The data behind is quite simple, with Region, Indicator, and Value as columns. Region is a list of regions, indicator is a list of indicators, and value is respective value, e.g. Europe, total population, xbillion.

 

When a region is selected in the slicer dropdown, the visuals show the data for that region. But when nothing is selected in the filter or selection is cleared, how can I make other graphs display "Europe" data by default?

 

I would prefer if there is a measure I can put as a filter at the page or visual level, otherwise, a measure conditionally filtering the value? 

Note that some values are strings.

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi zoffice 

    I think your data model is as below.

    If you want to calculate number you can use measure like Fowmy 's reply.

    If you want to retrieve string values you can try my measure.

     

    String = 
    IF( 
        ISFILTERED('Table'[Region]),  
        MAX('Table'[Value-string]),
        CALCULATE(
             MAX('Table'[Value-string]),
            'Table'[Region] = "Europe"
        )
    )

    Result is as below.

    By default:

    Select Asia:

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

6 Replies

  • zoffice 

    Try the following measure:

    Your Measure = 
    
    IF( 
        ISFILTERED(Table[Region]),  
        SUM(FactTable[Amount]),
        CALCULATE(
            SUM(FactTable[Amount]),
            Table[Region] = "Europe"
        )
    )

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply 🙂


    Website YouTube  LinkedIn

    • zoffice's avatar
      zoffice
      Helper I

      Thank you!

       

      How do I retrieve string values? 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi zoffice 

        I think your data model is as below.

        If you want to calculate number you can use measure like Fowmy 's reply.

        If you want to retrieve string values you can try my measure.

         

        String = 
        IF( 
            ISFILTERED('Table'[Region]),  
            MAX('Table'[Value-string]),
            CALCULATE(
                 MAX('Table'[Value-string]),
                'Table'[Region] = "Europe"
            )
        )

        Result is as below.

        By default:

        Select Asia:

         

        Best Regards,

        Rico Zhou

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

  • zoffice 

    Please check the below formula and adjust it as per your model.
    When no region is selected, it shows the Europe total and 

    Your  Measure = 
    
    IF( 
        ISFILTERED(Table6[Region]),  
        SUM(Table6[ Value-numerical]),
        CALCULATE(
            SUM(Table6[ Value-numerical]),
            Table6[Region] = "Europe"
        )
    )

     

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply 🙂


    Website YouTube  LinkedIn

  • zoffice 

    Not quite sure what you means by "retrieve string values". I assume you have a dimension table with a Region Column. 

    Please share some sample data based on your model and provide a clear explanation.


    You can save your files in OneDrive, Google Drive, or any other cloud sharing platforms and share the link here.
    ____________________________________
    How to paste sample data with your question?
    How to get your questions answered quickly?

    _____________________________________
    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube, LinkedIn

    • zoffice's avatar
      zoffice
      Helper I

      I have added some additional columns with text values such as "High-Income", that may not work with SUM i imagine.

       

      My data model structure is basically the following:

      Region, Indicator, Value-numerical, value-string

      Europe, Population, 1234656, ,

      Europe, Income-level, , High-income

      Asia, Population, 234567, ,

      Asia, Income-Level, , High-income