Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can I make a switch button which can exchange the column and row in pivot table?

a.JPG

Hello

Like the pic shows, Table 1 and table 2 are pivot tables and have the same content.

I want a button to switch table1 and table2. How can I do ?  Does a  micro do this?

I think there must be a property which can control the tables.

Who can help me about this? Thank you very much.

17 Replies
m_woolf
Master II
Master II

You could make 2 pivottables and use a button to determine which is visible.

Not applicable
Author

you can do it by macro

see att file

Not applicable
Author

Hi mwooif,

Thanks for your reply.

Because of my and expressions are all dynamic. My opinion trended towards Pari Pari‘s even I don not understand his opinion totally.

Not applicable
Author

Hi Pari Pari,

From your test qvw 's macro I find the difference between sub1 and sub2 is the

chart.AddDimension "week"
chart.AddDimension "year"
 

But I can't understand why the difference could affect the table’s stucture.

So could you please explain me more in details?

Thank you

Not applicable
Author

I get it!

The key is cp.TableProperties.NumberOfLeftDimensions = 0

Not applicable
Author

HI Pari,

One more question:

I wanna switch between 2 tables below. Let the macro control the table's look like.

1.JPG

I look up the API Guide but no clue. Please help me again. Thanks .

Not applicable
Author

i can't see the difference between your tables...

Not applicable
Author

The second column label.  One is "sum(value)"   the other is blank.

I can drag the label to switch with mouse.  

1.JPG

But I want a macro to control that.

1.JPG

Not applicable
Author

2.JPG

it is a something like bug

why you want to achieve that?

i suggest to use (show/hide) label name for this expression in your macro script

see att qvw file