3 Replies Latest reply on Aug 9, 2018 12:55 PM by Ken Flerlage

    Pie Chart Problem

    Mehak Babbar

      I need help with making a pie chart with three sections, along with a date filter

      1. People who lie only in category A.

      2. People who lie only in Category B.

      3. People who lie in both Category A and B.

      I tried using sets for the same. But they were not being filtered by date properly.

      PFA the workbook with sample data .

        • 1. Re: Pie Chart Problem
          Ken Flerlage

          I have a suspicion that someone will come up with a simpler solution, but this should work. First create a couple of calculated fields:

           

          In Category A

          // For each person, see if he/she is in category A.

          {FIXED [Name]: COUNTD(IIF([Category]="A", [Category], NULL))}

           

          In Category B

          // For each person, see if he/she is in category B.

          {FIXED [Name]: COUNTD(IIF([Category]="B", [Category], NULL))}

           

          In Categories A & B

          // Is the person in both categories?

          IF [In Category A]=1 AND [In Category B]=1 THEN

              1

          ELSE

              0

          END

           

          Each of these will either be a 1 or a 0, which will allow you to easily sum them.

           

          Since we're using LOD calculations, you'll want to right-click on your Date filter and choose "Add to Context." This will ensure that the filter is applied before the LOD is calculated.

           

          You can now use Measure Values and Measure Names to create your pie chart as shown below:

           

           

          See attached workbook.

          • 2. Re: Pie Chart Problem
            Mehak Babbar

            Thanks a lot Ken!

            The solution worked for me.

            • 3. Re: Pie Chart Problem
              Ken Flerlage

              Fantastic!