Forum Discussion

khsingh's avatar
khsingh
Regular Visitor
2 years ago

Stacked Chart - how to split Y axis value based on X axis but consider total value to divide

Hi,

 

in stacked chat i have used four columns on Y axis and two columns on X Axis and its connecetd to SSAS Tabular.

the Y axis bars gets Splitted based on X axis but  i want avoid one of the colum which was used on X Axis for caluculation of split.

 

For Example : for July month i have thee type of bars and every bar showing 100%

 

But i am expecting the total of three bars of july month is 100%.

 

 

7 Replies

    • khsingh's avatar
      khsingh
      Regular Visitor

      Hi,

       

      Thanks for your message but its not helpful for my requirement.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi khsingh 

         

        Maybe you can using the Stacked column chart instead of 100% Stacked column chart:

        Here I create a set of sample:

        Then add 2 measures to calculate the percentage, it is important to note that the denominator is the sum of all the data, not the sum of the individual columns:

         

        MEASURE =
        SUM ( 'Table'[Values] )
            / (
                SUMX ( ALLSELECTED ( 'Table' ), 'Table'[Values] )
                    + SUMX ( ALLSELECTED ( 'Table' ), 'Table'[Values2] )
            )
        
        MEASURE 2 =
        SUM ( 'Table'[Values2] )
            / (
                SUMX ( ALLSELECTED ( 'Table' ), 'Table'[Values] )
                    + SUMX ( ALLSELECTED ( 'Table' ), 'Table'[Values2] )
            )
        

         

        The result is as follow:

         

         

        Best Regards

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