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 compare the 'sales' in % but for each company i want the % of their total sales and not the % of all (merged) sales - this way i can compare fairly how much of each product gets sold per company. i know this is easy to show in 2 visuals next to eachother but for space reasons and the looks this will work great! 

 

 

i hope this is enough information provided to get an anwser!

 

PS: I added a test data to show my question - the data is made the simplest i could

https://kpn1271380.sharepoint.com/:u:/g/Ee-2Z_oHHY1Orib_55dRVLMBKVqqOUv12E9w_0Z1leE2aA?e=Yh2S3B 

  • 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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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

    • ThomasJB2004's avatar
      ThomasJB2004
      Regular Visitor

      Hi Anonymous 

       

      Thanks for the solution, it works exactly as i intended !

       

  • 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