Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Summarize two bars to one bar

Hello together,

 

I have a bar chart where you can see accounting indicators (1C, 1E, 1F, 1W, 2W…) per month. For each indicator Power BI makes a new bar in the chart. Is it possible to summarize two indicators (e.g. 1W + 2W) in one bar together? Maybe with a measure or something like this? In the attached picture you can see the two bars with should be one bar together.

 

Thanks

 

bar chart

  • Anonymous

     

    As MattAllington said, we can create a column with formula like below.

    New CSW Flag = 
    IF (
        'CCCE WSPs'[CSW Flag] = "1W"
            || 'CCCE WSPs'[CSW Flag] = "2W",
        "1W+2W",
        'CCCE WSPs'[CSW Flag]
    )

    Then drag this new created column to Column series.

     

    Best Regards,

    Herbert

4 Replies

  • MattAllington's avatar
    MattAllington
    Icon for Community Champion rankCommunity Champion

    Deutscher?  I remember the "Hallo zusammen" translation :-)

     

    There are a few ways of doing this, but it depends on what you are trying to do more broadly.    You can hard code a measure that joins 2 together, but then you will need to hard code measures for every other item too.  You could create a calculated column that combines 2 togehter, and then you can just drop the column on the axis to get the result.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Gut aufgefasst! :-)

       

      Hoe does it work excactly? I tried this measure here but it doesn´t work:

       

      Measure = CALCULATE(COUNTROWS('CCCE WSPs');'CCCE WSPs'[CSW Flag]="1W") + CALCULATE(COUNTROWS('CCCE WSPs');'CCCE WSPs'[CSW Flag]="2W")   (CSW Flag are the accounting indicators)

       

      How do you make it with the calculated columns? It doesn´t work either...

       

       

       

      • v-haibl-msft's avatar
        v-haibl-msft
        Icon for Microsoft Employee rankMicrosoft Employee

        Anonymous

         

        As MattAllington said, we can create a column with formula like below.

        New CSW Flag = 
        IF (
            'CCCE WSPs'[CSW Flag] = "1W"
                || 'CCCE WSPs'[CSW Flag] = "2W",
            "1W+2W",
            'CCCE WSPs'[CSW Flag]
        )

        Then drag this new created column to Column series.

         

        Best Regards,

        Herbert