Grouping my data

I am building a card that lists out quantity for each Action (STARTS, RESTARTS, TERMINATES, STOPS).  Each Set of Actions can fall into a different Week (WEEK1, WEEK2, WEEK3, WEEK4 & WEEK5).  My data is summing up but it is creating multiple duplicate lines (See Screen shot).  How do I get each action to show only once and display each weeks total vs creating new lines for each weeks totals?

 

Here are my CASE satements for the WEEKS as of now...

 

WEEK1
(CASE
  WHEN `weekoffiscalperiod`='1' THEN COUNT(DISTINCT CONCAT

(`DataSourceDB`,'_',`phoneid`,'_',`actionid`,'_',`reason`,'_',`date1`))
  ELSE 0
  END)


WEEK2
(CASE
  WHEN `weekoffiscalperiod`='2' THEN COUNT(DISTINCT CONCAT

(`DataSourceDB`,'_',`phoneid`,'_',`actionid`,'_',`reason`,'_',`date1`))
  ELSE 0
  END)


WEEK3
(CASE
  WHEN `weekoffiscalperiod`='3' THEN COUNT(DISTINCT CONCAT

(`DataSourceDB`,'_',`phoneid`,'_',`actionid`,'_',`reason`,'_',`date1`))
  ELSE 0
  END)


WEEK4
(CASE
  WHEN `weekoffiscalperiod`='4' THEN COUNT(DISTINCT CONCAT

(`DataSourceDB`,'_',`phoneid`,'_',`actionid`,'_',`reason`,'_',`date1`))
  ELSE 0
  END)


WEEK5
(CASE
  WHEN `weekoffiscalperiod`='5' THEN COUNT(DISTINCT CONCAT

(`DataSourceDB`,'_',`phoneid`,'_',`actionid`,'_',`reason`,'_',`date1`))
  ELSE 0
  END)

 

Comments

  • Change the aggregate for each value in the chart to SUM or MAX


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • If that doesn't work, you can try to alter your beastmode a bit:

    COUNT(DISTINCT CASE
    WHEN `weekoffiscalperiod`='1' THEN CONCAT
    (`DataSourceDB`,'_',`phoneid`,'_',`actionid`,'_',`reason`,'_',`date1`)
    END)

    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • Thank you for the help.  When you say change the values are you referring to the SALES CATEGORY?

This discussion has been closed.