Forum Discussion

ThomasJB2004's avatar
ThomasJB2004
Regular Visitor
2 years ago
Solved

Problems with creating a certain type of column chart

Morning,   This is my first time on here so i am hoping someone knows how to help me.   I am trying to create a ''Visual'' with a 2 columns both showing the result of their total.   I want to c...
  • Ritaf1983's avatar
    2 years ago

    Hi ThomasJB2004 

    To achieve the desired result you can create 2 measures :

    A percent = DIVIDE(CALCULATE(sum('Sheet 1'[Type of Product]),'Sheet 1'[Company ]="A"),sum('Sheet 1'[Type of Product]))
    B percent = DIVIDE(CALCULATE(sum('Sheet 1'[Type of Product]),'Sheet 1'[Company ]="B"),sum('Sheet 1'[Type of Product]))
    and put them on Y axis:

    If this post helps, then please consider Accepting it as the solution to help the other

    members find it more quickly

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, ThomasJB2004 

    May I ask if this is the expected output you are looking for? Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.

     

    Measures:

     

    A =
    
    VAR _A =
    
        CALCULATE ( SUM ( 'Sheet 1'[Type of Product] ), 'Sheet 1'[Company ] = "A" )
    
    VAR _totalA =
    
        CALCULATE (
    
            SUM ( 'Sheet 1'[Type of Product] ),
    
            'Sheet 1'[Company ] = "A",
    
            ALL ( 'Sheet 1' )
    
        )
    
    RETURN
    
        DIVIDE ( _A, _totalA )
    
    
    
    B =
    
    VAR _B =
    
        CALCULATE ( SUM ( 'Sheet 1'[Type of Product] ), 'Sheet 1'[Company ] = "B" )
    
    VAR _totalB =
    
        CALCULATE (
    
            SUM ( 'Sheet 1'[Type of Product] ),
    
            'Sheet 1'[Company ] = "B",
    
            ALL ( 'Sheet 1' )
    
        )
    
    RETURN
    
        DIVIDE ( _B, _totalB )

     

    If this does not work, could you please share some sample data without sensitive information and expected output.
    How to provide sample data in the Power BI Forum - Microsoft Fabric Community

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum