Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sanp96
Contributor III
Contributor III

Creating Pivot tables based on a condition

Hello everyone,

I am working on a building a Pivot table which is based off a table that is as follows:

Store NumberProduct codeOrder NumberisException
1A123445N
2B737487Y
3A256373Y
3A984747Y
4B267363Y
4A747367Y
5C398827N

 

I want to create a Pivot table that has only those rows that has isException = 'Y' and I want the values to be the count of Order Number for that product for that store.  So, I am trying to create something like this:

Store NumberAB
2 1
32 
411

 

What I have tried so far is created a dimension Aggr(if(isException = 'Y', Store Number,), Store Number, Order Number). This is giving me values that don't seem to match the expected. Should there be any condition on the columns or on the values part?

Any suggestions on how this can be done?

Any help is highly appreciated. 

Thanks!

 

1 Solution

Accepted Solutions
Lisa_P
Employee
Employee

What you need is:

 - 2 dimensions, Store Number, Product code

 - 1 measure: Count({<isException={Y}>}[Order Number])

Once you create it looks like this:

Lisa_P_0-1630539690018.png

Then drag Product code across to the measure side and you get this:

Lisa_P_1-1630539747073.png

 

View solution in original post

2 Replies
Lisa_P
Employee
Employee

What you need is:

 - 2 dimensions, Store Number, Product code

 - 1 measure: Count({<isException={Y}>}[Order Number])

Once you create it looks like this:

Lisa_P_0-1630539690018.png

Then drag Product code across to the measure side and you get this:

Lisa_P_1-1630539747073.png

 

sanp96
Contributor III
Contributor III
Author

Thanks a lot! This worked after adding keyword 'distinct'