Help with Percent on Stacked Bar Chart

  • Help with Percent on Stacked Bar Chart

    Posted by DSC Communities on April 16, 2020 at 8:52 am
    • Sergio Medina

      Member

      April 16, 2020 at 8:52 AM

      Hi

      I made a stacked bar chart to show gender data over a period of years, I was able to show the percent with this measure:

      Gender % = DIVIDE(DISTINCTCOUNT(‘Table1′[PIDM]),CALCULATE(DISTINCTCOUNT(‘Table1′[PIDM]),ALLEXCEPT(‘Table1’,’Table1′[Year])))

      Now the problem I have is that when I add a slicer (lets use state as example) when I click on one of the options the percent show is not within what is filtered.

      Example: No slicer shows for 2014 61% Male and 39% Female click on Oregon state slicer and it shows 22% Male and 33% Female which clearly does not add 100%

      What I’m doing wrong?

      ——————————
      Sergio Medina
      IT
      7033827828
      ——————————

    • William Skelley

      Member

      April 16, 2020 at 9:01 AM

      Hi Sergio:

      I think you want to use “ALLSELECTED” – please see my example. You just swop-in your fields.

      Share % of Sales = DIVIDE(
      SUMX(Sales, Sales[Sales Amount (Actual)] – Sales[Discount Amount]),
      SUMX(ALLSELECTED(Sales), Sales[Sales Amount (Actual)] – Sales[Discount Amount]))

      I hope this helps.

      Best regards,

      Bill S

      ——————————
      William Skelley
      01106
      Longmeadow MA
      8602807221
      ——————————
      ——————————————-

    • Sergio Medina

      Member

      April 16, 2020 at 12:00 PM

      You mean this?

      Gender % = DIVIDE(DISTINCTCOUNT(‘Table1′[PIDM]),CALCULATE(DISTINCTCOUNT(‘Table1′[PIDM]),ALLSELECTED(‘Table1’,’Table1′[Year])))

      Because it doesn’t work

      ——————————
      Sergio Medina
      IT
      7033827828
      ——————————
      ——————————————-

    • William Skelley

      Member

      April 16, 2020 at 2:36 PM

      Hi Sergio:

      I’m happy to look at your file (or abbreviated example) to best answer it.

      Thank you,

      Bill S.

      ——————————
      William Skelley
      01106
      Longmeadow MA
      8602807221
      ——————————
      ——————————————-

    • Sergio Medina

      Member

      April 16, 2020 at 3:19 PM

      Does this help?

      ——————————
      Sergio Medina
      IT
      7033827828
      ——————————
      ——————————————-

    • Sergio Medina

      Member

      April 16, 2020 at 3:29 PM

      I just noticed that I wasted a day creating a formula when all I needed was to choose 100% stack bar chart, I’m so sorry.

      ——————————
      Sergio Medina
      IT
      7033827828
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 11 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Help with Percent on Stacked Bar Chart’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!