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: 
brunolelli87
Creator II
Creator II

Condition on Expression > Working with Bar Charts

Hello Guys,

I have a chart in my project, with the following

  • Dimension:
    CompanyNames
  • Expressions:
    =num(avg(LPA), '#.##0,00;-#.##0,00')

This chart shows some companies and it's average of PLA, as you can see below:
LPA.png

When the user click on a bar representing a company, let's suppose he chooses the red bar AZUL4, the system shows 2 new expressions (Média do Setor and Média do Subsetor), based on the following condition:

LPA2.png

And the chart will look like this:

LPA3.png
Now, I would like to:
If the user click on the AZUL4 Bar again, (the one with a value of -7,03) the system should show another expression and dimension that is:

  • Expression: =sum([Lucro/Prejuízo do Período])*1000/sum(NumeroDeAções)
  • Dimension: =Date(Periodo, 'MM/YY')

And the shart should look like to:

LPA4.png

How can I do it?
Thanks


Bruno

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes, that's quite possible. The precise approach depends somewhat on exactly how you want it to behave and what's easiest to maintain. 

It seems like you've got the first part, conditionally showing expressions when one Sticker is selected.  Part two would be knowing when that Sticker is selected again and applying the condition to additional expressions.  One way to do that is make a copy of the Sticker field, in perhaps another field named "StickerDrill".  Make StickerDrill a Dimension that's conditionally visible when GetSelectedCount(Sticker) = 1 and make Sticker conditional on GetSelectedCount(Sticker) =0. 

So then you are showing one or the other, and can use conditional expressions testing GetSelectedCount for Sticker and StickerDrill to see where you are in the flow.  Hopefully the attached example is a clear enough example. 

-Rob

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes, that's quite possible. The precise approach depends somewhat on exactly how you want it to behave and what's easiest to maintain. 

It seems like you've got the first part, conditionally showing expressions when one Sticker is selected.  Part two would be knowing when that Sticker is selected again and applying the condition to additional expressions.  One way to do that is make a copy of the Sticker field, in perhaps another field named "StickerDrill".  Make StickerDrill a Dimension that's conditionally visible when GetSelectedCount(Sticker) = 1 and make Sticker conditional on GetSelectedCount(Sticker) =0. 

So then you are showing one or the other, and can use conditional expressions testing GetSelectedCount for Sticker and StickerDrill to see where you are in the flow.  Hopefully the attached example is a clear enough example. 

-Rob

brunolelli87
Creator II
Creator II
Author

Hello,

Thanks for your very clear explanation!

But I don't want to have the same kind of content as dimension (Sticker) or (StickerDrill). Based on what you said, StickerDrill is a copied content from Sticker, so, basically they are the same information.

I would like to change the Dimension, from (Sticker) to (Periodo).

Sticker is like companies, so it's a list of names
Periodo is date information, so it's a list of dates.

 

How can I do it?
Thanks

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think the concept is the same. Add Perido as a conditional dimension and show it when both Sticker and StickerDrill selected = 1.  See attached updated example.

-Rob

brunolelli87
Creator II
Creator II
Author

Hello

 

Thank you so much!

The example you provided me was amazying, and I could easily adapt to my project!