Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Bar Chart - Same variable but multiple time in X-axis

I am a newbie in this Power BI software and downloaded two days back. Actually I have two columns, one is "Type" (nominal data) and the second one is "Speed" (numerical data/measure). Some Type can repeat itself like Type1 when run the first time it gives Speed of 2, but when it was run the second time it gave Speed of 3. Whenever I am trying to produce a bar chart, instead of showing type1 with their Speed separately, it is giving me the same type with the sum of Speed. In this case Type1 resulting in 5 (Sum of Speed). How can I present type1 multiple times in the x-axis of a bar chart with their respective speed in the y-axis?

 

Thanks in advance. 

  • Hi Anonymous ,

     

    Unless you mark duplicate types separately, they will be aggregated.

    Column = 
    VAR x = 
    RANKX(
        FILTER(
            Sheet2,
            Sheet2[Type ] = EARLIER(Sheet2[Type ])
        ),
        [Speed], ,ASC, Dense
    )
    RETURN
    [Type ] & "(" & x & ")"

     

    Best regards,
    Lionel Chen

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

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    So, sample data and expected output would assist greatly. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

     

    But, a couple things to try. Perhaps try setting Speed to "Do not aggregate". Doubt that will work in the case of a bar chart.

     

    Second thing to try, if you have something that identifies a Type1 as unique, put it in your Axis hierarchy above "type" and then drill into the hierarchy using the forked arrow icons.

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

    Hi Anonymous ,

     

    Unless you mark duplicate types separately, they will be aggregated.

    Column = 
    VAR x = 
    RANKX(
        FILTER(
            Sheet2,
            Sheet2[Type ] = EARLIER(Sheet2[Type ])
        ),
        [Speed], ,ASC, Dense
    )
    RETURN
    [Type ] & "(" & x & ")"

     

    Best regards,
    Lionel Chen

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