Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to find out how many same Company buying from Supplier A and B ?

Hi All

Now i need to create a pivot table :-

Dimension = SOURCE , company_ar

Expression :- Sun(total_ar)

And export table to excel , and sort to find out same company in SOURCE = PM AND PW.
It there any way i can do it in expression  in QV ?

Paul Yeo

 

1 Solution

Accepted Solutions
Saravanan_Desingh

I could not open your QV. But see my example.

tab1:
LOAD 'Company '& Pick(Ceil(19*Rand()),'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s') As Company,
 	 Round(  1000*Rand()*Rand()) As Sales,
	 'Supplier '& Pick(Ceil(2*Rand()),'A','B') As Supplier
AutoGenerate 25;

Expression:

Only({<Company=p({<Supplier={'Supplier A'}>})*p({<Supplier={'Supplier B'}>})>} Company)

commQV56.PNG

View solution in original post

6 Replies
paulyeo11
Master
Master
Author

Hi All

My QVW

Saravanan_Desingh

I could not open your QV. But see my example.

tab1:
LOAD 'Company '& Pick(Ceil(19*Rand()),'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s') As Company,
 	 Round(  1000*Rand()*Rand()) As Sales,
	 'Supplier '& Pick(Ceil(2*Rand()),'A','B') As Supplier
AutoGenerate 25;

Expression:

Only({<Company=p({<Supplier={'Supplier A'}>})*p({<Supplier={'Supplier B'}>})>} Company)

commQV56.PNG

paulyeo11
Master
Master
Author

Hi Sir

Thank you very much , your expression is very flexible , it all me to add more supplier.

Now I have one more request. that is I have 3 supplier , if any company appear in any 2 supplier , I need to flag the company , it is possible ? instead of company must appear at all 3 company. 

The reasons is if I have 3 supplier , all customer appear in 3 supplier , the listing is very few to meet the criteria.

Paul

Saravanan_Desingh

Please try this.

Only({<Company={"=Count(DISTINCT Supplier)>=2"}>} Company)

 

paulyeo11
Master
Master
Author

Hi All

I move this to top.

Paul