10 Replies Latest reply: Apr 21, 2017 5:51 AM by Amit Saini RSS

    Expression Help ???

    Amit Saini

      Hi Folks,


      I need help in below logic.


      I'm having shift wise stacked bar chart which is showing "Pieces Produced" across 3 shifts , like below:


      Dim : 1. Date

               2. Shift_Name




      Pieces Produced : =num(Count(DISTINCT  Serial))




      Now I have to calculate "Total Pieces Produced " and the logic for this should be :


      TOTAL PIECES PRODUCED = Above Calculation of Pieces Produced + [NO CAQ SCRAP FLAG]

      So condition for [NO CAQ SCRAP FLAG] is vNScrapFlag =SUM( {$<Type_Name = {'Scrap'},Production = {'NoCAQ'}>} Quantity)

      I'm trying below expression to achieve Total Pieces , but it not working as expected :

      =num(Count(DISTINCT  Serial)) + vNScrapFlag

      See below:

      As you can see above in Scrap Produced graph , we are having count "2" in Spat shift and "16" in Nacht Shift , so in bar chart of Total Pieces Produced it should add 2 to 243 Spat shift and 16 to 302 Nacht Shift.

      By using =num(Count(DISTINCT  Serial)) + vNScrapFlag , it is adding "18" to all the shifts which is wrong. The correct Output should be as marked in yellow circle.

      I hope I'n clear here!

      Please suggest how I can achieve this.

      Attached is demo qvw.