Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Dynamic Names axis based on selected filter.

Hi All,   I've a question about a dynamic axis in charts. I have sales data from different countries. To put them all in a chart is a bit too much so I have sorted the countries into regions. So Am...
  • Barthel's avatar
    3 years ago

    Hey Anonymous,
    This is possible by creating a table in which the regions are columns and the rows are countries. And then create a field parameter on it. I used the following sample data:

    Dim_Countries:

    CountryRegionSales

    1A8
    2A12
    3A54
    4B21
    5B76
    6B32
    7B89
    8B21
    9C40
    10C4

    Dim_Region:
    Region

    A
    B
    C

    Dim_Country_Region (combination table in which you indicate per country to which region it belongs. You could create this table dynamically in M ​​by pivoting the region column in the countries table):

    CountryABC

    11  
    22  
    33  
    4 4 
    5 5 
    6 6 
    7 7 
    8 8 
    9  9
    10  10

    Field paramter (refer to the general region column and call it 'All'. And select all the region columns from the combination table underneath):

     

     

    Parameter = {
        ("All", NAMEOF('Dim_Region'[Region]), 0),
        ("A", NAMEOF('Dim_Country_Region'[A]), 1),
        ("B", NAMEOF('Dim_Country_Region'[B]), 2),
        ("C", NAMEOF('Dim_Country_Region'[C]), 3)
    }

     

     

    This is how the models looks:

    Use the field parameter as a slicer. And also place the field parameter on the x axis of a visual.

    'All' selected:

    When you select one region: