Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
amit_saini
Master III
Master III

Expression Help ???

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

Expression:

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.


Thanks,

AS

1 Solution

Accepted Solutions
amit_saini
Master III
Master III
Author

Hi Anil,

Thank you!

I will try this also and update you.

But I got the solution by using below expression:

num(Count(DISTINCT  Serial)) + SUM({$<Type_Name = {"Scrap"}>} Quantity) -SUM( {$<Type_Name = {'Scrap'},Production = {'CAQ'}>} Quantity)

Thanks,

AS

View solution in original post

10 Replies
amit_saini
Master III
Master III
Author

Any Suggestions???

Thanks,

AS

Anil_Babu_Samineni

Are you expecting changes over here - Total Pieces Produced stacked by shift ??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
amit_saini
Master III
Master III
Author

Yes Anil.

Thanks,

AS

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

The shared qvw file shows the same result as you want?

Please help me understand what exactly you need.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anil_Babu_Samineni

Is this you are expecting

I have removed Shift_Name and i added

Calc. Dimension:

=ValueList('Früh','Nacht','Spät')

Expression:

If(ValueList('Früh','Nacht','Spät') = 'Nacht',num(SUM( {$<Shift_Name = {'Nacht'}, Type_Name = {'Scrap'}>} Quantity)), If(ValueList('Früh','Nacht','Spät') = 'Spät',

num(SUM( {$<Type_Name = {'Scrap'}, Shift_Name = {'Spät'}>} Quantity)),

If(ValueList('Früh','Nacht','Spät') = 'Früh',num(Count(DISTINCT {<Shift_Name = {'Früh'}>} Serial)))))

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
amit_saini
Master III
Master III
Author

Hi Anil,

Thank you!

I will try this also and update you.

But I got the solution by using below expression:

num(Count(DISTINCT  Serial)) + SUM({$<Type_Name = {"Scrap"}>} Quantity) -SUM( {$<Type_Name = {'Scrap'},Production = {'CAQ'}>} Quantity)

Thanks,

AS

Anil_Babu_Samineni

Good, And this expression gives me this. Is this you are expecting??

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
amit_saini
Master III
Master III
Author

Yes Anil!

Thanks,

AS

Anil_Babu_Samineni

Haha, I thought that is x not the + . Anyway, Thanks for coming back

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful