Forum Discussion

rogeriosouzax's avatar
rogeriosouzax
Regular Visitor
7 years ago
Solved

Problem calculating percentage total - bar chart

Hello guys!

 

I'm new in Power BI :) I'm trying to create a bar chart to display my data but it's working partially.

 

I create a new measure to calculate the percentage of total. Follow my formula:

Medida = DIVIDE(COUNT(Consulta1[Intervalo]);CALCULATE(COUNT(Consulta1[Intervalo]);ALLEXCEPT(Consulta1;Consulta1[Familia_Concorrente_SAP];Consulta1[Ano];Consulta1[Mes];Consulta1[Br_atual];Consulta1[Regional_atual];Consulta1[UF]; Consulta1[CANAL_Atualizado];Consulta1[SUB CANAL_Atualizado];Consulta1[ABORDAGEM_Atualizado];Consulta1[FAMÍLIA SAP];Consulta1[EMBALAGEM SAP])))
 
This is a scenario using a filter that works properly.
This is a scenario that I use a multi-selection filter in field "UF", when I use "multi-selection" the value display becomes incorrect. Follow example:
My question is: why it works properly in a specific scenario and it doesn't using multi-selection one.
 
Best regards,
 
Roger
  • Vvelarde's avatar
    Vvelarde
    7 years ago

    rogeriosouzax

     

    Hi, try with this:

     

    Medida = DIVIDE(SUM(Table1[Valor]),CALCULATE(SUM(Table1[Valor]),ALLSELECTED(Table1[Faixa])))

    Regards

     

    Victor

     

6 Replies

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

    rogeriosouzax,

     

    Seems like the slicers are both multi-selection slicers in your two screenshots, to be general, you may modify your measure like pattern below and try again:

    Medida =
    DIVIDE (
        COUNT ( Consulta1[Intervalo] );
        CALCULATE ( COUNT ( Consulta1[Intervalo] ); ALLSELECTED ( Consulta1 ) )
    )
    

    Community Support Team _ Jimmy Tao

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

    • rogeriosouzax's avatar
      rogeriosouzax
      Regular Visitor

      v-yuta-msft,

      Thank you for feedback :)

      I tried the pattern that you suggested. It works but not like I expected.

       

      I got the total percentage, if I sum all values referent A and B I have 99,99% and it's right. But I need that the sum of all B columns displays 100%(or almost it) and all A columns displays 100%(or almost it).

       

      How could I do that? Is it possible? I tried the last pattern with ALLEXCEPT but using some filters the value displayed is incorrect.

       

      Best regards,

       

      Roger.

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

        rogeriosouzax,

         


         I got the total percentage, if I sum all values referent A and B I have 99,99% and it's right. But I need that the sum of all B columns displays 100%(or almost it) and all A columns displays 100%(or almost it).

         

        How could I do that? Is it possible? I tried the last pattern with ALLEXCEPT but using some filters the value displayed is incorrect.

         




        I tried the pattern that you suggested. It works but not like I expected.

         

        Could you clarify more about "display 100%"? If possible, could you please share some sample data?

         

        Community Support Team _ Jimmy Tao

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