Skip to main content

Hey guys,

 

See below my original table. In the grand total section, it shows the data in male and female in different colors.

How do you calculate totals based on genders?

When I convert the table into a bar graph, the totals stack onto one another, like this:

 

I would prefer the total has a similar format as my other six regions though...

Screen+Shot+2017-09-05+at+11.49.37.png

I'd like the two bars stand side by side like others do; is there a way to do that that?

 

Thank you so much!

8 answers
  1. Sep 6, 2017, 4:44 AM

    Hi Xiao,

     

    Create sql query as

    SELECT [Orders].[Category] AS [Category],

      [Orders].[OrderDate] AS [OrderDate],

      [Orders].[OrderID] AS [OrderID],

      [Orders].[Profit] AS [Profit],

      [Orders].[Quantity] AS [Quantity],

      [Orders].[Sales] AS [Sales],

      [Orders].[Segment] AS [Segment],

      [Orders].[SubCategory] AS [SubCategory],

    'Data' as [Data]

    FROM [dbo].[Orders] [Orders]

    Union All

    SELECT [Orders].[Category] AS [Category],

      [Orders].[OrderDate] AS [OrderDate],

      [Orders].[OrderID] AS [OrderID],

      [Orders].[Profit] AS [Profit],

      [Orders].[Quantity] AS [Quantity],

      [Orders].[Sales] AS [Sales],

      [Orders].[Segment] AS [Segment],

      [Orders].[SubCategory] AS [SubCategory],

    'Total' as [Data]

    FROM [dbo].[Orders] [Orders]

     

    Create calc as

    if ['Data']='Data' then [Category]

    else 'Total'

    END

     

    Drag created calc and gender into column  and sales into row. drag gender into color.

     

    Refer below

    Hi Xiao, Create sql query asSELECT [Orders].[Category] AS [Category], [Orders].[OrderDate] AS [OrderDate], [Orders].[OrderID] AS [OrderID], [Orders].[Profit] AS [Profit], [Orders].

0/9000