Forum Discussion

powerbityro's avatar
powerbityro
Helper II
6 years ago
Solved

bar chart with selectable y axis

Hi all,

I want a bar chart with the categories A,B,C,D,E as x axis and with a time period as y axis. The values are the lenght of a project. The user can chose the time period. For example 10 years. I have the categories and the values in a table:

A 3

B 7

C 9

D 13

E 16

How can I create the time period for the y axis?

Many Thanks

  • Hi,

     

    I am confused with your requirement, and i guess you want to filter the category, right?

    If so, i create a calculated table:

     

    Slicer = GENERATESERIES(1,20,1)

     

    Choose a slicer visual and it shows:

    Then create a measure:

     

    Measure = 
    IF (
        MAX ( 'Table'[Value] ) <= SELECTEDVALUE ( Slicer[Slicer] ),
        CALCULATE ( SUM ( 'Table'[Value] ) ),
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( 'Table', 'Table'[Value] < SELECTEDVALUE ( Slicer[Slicer] ) )
        )
    )

     

    Choose a stacked bar chart visual, when you select one number in slicer, it shows:

     

    Best Regards,

    Giotto Zhi

1 Reply

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Community Support

    Hi,

     

    I am confused with your requirement, and i guess you want to filter the category, right?

    If so, i create a calculated table:

     

    Slicer = GENERATESERIES(1,20,1)

     

    Choose a slicer visual and it shows:

    Then create a measure:

     

    Measure = 
    IF (
        MAX ( 'Table'[Value] ) <= SELECTEDVALUE ( Slicer[Slicer] ),
        CALCULATE ( SUM ( 'Table'[Value] ) ),
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( 'Table', 'Table'[Value] < SELECTEDVALUE ( Slicer[Slicer] ) )
        )
    )

     

    Choose a stacked bar chart visual, when you select one number in slicer, it shows:

     

    Best Regards,

    Giotto Zhi