Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
musketeers
Creator
Creator

iSSUE WITH SET ANALYSIS

Hi, I need a help in comples set analysis.

For the below data, we have multiple Products and Error ID. Error IDs are related to few Products. The requirement is to get the Sum of Volume for Error IDs but the twist is that for the given date we need to find the related Products and for those products we need to find the sum of Volume. So the output of the below data should be:

DATE ERROR_ID TOTAL_VOLUME
1/10/2023 ERR_1 608
2/10/2023 ERR_2 667

 

I have written the below set analysis but its not working:

SUM({<Product=p({<Error_ID=p(Error_ID)>}Product)>}Volume)

Could you please help me to acheive this output.

Thanks in advance.

The load statement of the sample data is as below:

load * Inline[
Date, Product, Error_ID, Volume
1/10/2023, P1 ,, 23
1/10/2023, P1 ,,24
1/10/2023, P1, , 25
1/10/2023, P1, ERR_1, 26
1/10/2023, P2 ,, 27
1/10/2023, P2,, 28
1/10/2023, P2 ,ERR_1, 29
1/10/2023, P3 ,, 30
1/10/2023, P3 ,, 31
1/10/2023, P3 ,, 32
1/10/2023, P3 ,, 33
1/10/2023, P3 ,, 34
1/10/2023, P3 ,ERR_1, 35
1/10/2023, P4 ,, 36
1/10/2023, P4 ,, 37
1/10/2023, P4 ,, 38
1/10/2023, P4 ,ERR_1, 39
1/10/2023, P4 ,, 40
1/10/2023, P4 ,, 41
1/10/2023, P5 ,, 23
2/10/2023, P5 ,, 24
2/10/2023, P5 ,, 25
2/10/2023, P5 ,ERR_2, 26
2/10/2023, P6 ,, 27
2/10/2023, P6 ,, 28
2/10/2023, P6 ,ERR_2, 29
2/10/2023, P7 ,, 30
2/10/2023, P7 ,, 31
2/10/2023, P7 ,, 32
2/10/2023, P7 ,, 33
2/10/2023, P7 ,, 34
2/10/2023, P7 ,ERR_2, 35
2/10/2023, P8 ,, 36
2/10/2023, P8 ,, 37
2/10/2023, P8 ,, 38
2/10/2023, P8 ,ERR_2, 39
2/10/2023, P8 ,, 40
2/10/2023, P8 ,, 100

];

 

Labels (2)
12 Replies
Gabbar
Specialist
Specialist

I hope You have Loaded the sample Data that you gave us,
Now if you directly load that sample data then There are not nulls in ErrorID but Empty Strings.
Loaded This:-

Gabbar_0-1701687691853.png

and got this in Data

Gabbar_1-1701687718221.png

.
But I thought that in your real database those values are null values so i changed my script to this:

Gabbar_2-1701687763912.png

and then got this output

Gabbar_3-1701687784713.png

.
Please check in you original Database(Not the sample you pro) that if those values are null values or empty string values.
If those are null my solution should work, If those are empty strings than we need to create new solution.


If those are empty strings then try creating this as dimension:-
=aggr(Only({<Error_ID={"=(len(Error_ID)>1)"} >}Error_ID),Product)

Gabbar_0-1701688086232.png

 

Ahidhar
Creator III
Creator III

Yes , now its working 

Gabbar
Specialist
Specialist

Mark the question as Solved.