Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Gurus,
I am looking for something like this in Qlik, I need to dynamically change the dimensions to be changed based on from which filter I am selecting values from. This seems a bit confusing, hence mentioned is the structure of my data.
Parent Segment | Segment | Value |
Segment_F | Segment_A | 60 |
Segment_F | Segment_A | 35 |
Segment_F | Segment_A | 60 |
Segment_F | Segment_A | 60 |
Segment_F | Segment_A | 60 |
Segment_F | Segment_B | 60 |
Segment_G | Segment_D | 85 |
Segment_G | Segment_C | 135 |
Segment_G | Segment_C | 110 |
Segment_G | Segment_D | 60 |
Segment_G | Segment_C | 35 |
Segment_G | Segment_D | 60 |
So at top I have two filters, one each for Segment and Parent Segment. I would be making selection in either of the table at a time only.
So if I select 'Segment F' in Parent Segment filter, below is the desired result;
dimension | Total Value |
Segment_A | 275 |
Segment_B | 60 |
But, if I clear all the filters and this time select 'Segment C' in Segment filter, below is the desired result;
dimension | Total Value |
Segment_C | 280 |
So as you see I'm looking to change the dimension based on, from which filter I am making selection. I have tried few things out, but not with much luck! Is this possible in Qlik and if yes, can anyone please help me out here?
@Saurabh07 try this :
in dimension:
=if(getselectedcount([Parent Segment])>0,
aggr(only(Segment),Segment),if(getselectedcount(Segment)>0,
Segment
))
in measure :
=sum(Value)
output:
select F in parent
select c in segment
@Taoufiq_Zarra Hey, you are magician! I have started believing that nothing is impossible in Qlik. I have made slight change to the formula though, but yours is working fine as well!! Thank a ton!
=if(getselectedcount([Parent_Segment])>0,
aggr(only([Parent_Segment]),[Parent_Segment]),if(getselectedcount(Segment)>0,
Segment
))
@Saurabh07 try this :
in dimension:
=if(getselectedcount([Parent Segment])>0,
aggr(only(Segment),Segment),if(getselectedcount(Segment)>0,
Segment
))
in measure :
=sum(Value)
output:
select F in parent
select c in segment
@Taoufiq_Zarra Hey, you are magician! I have started believing that nothing is impossible in Qlik. I have made slight change to the formula though, but yours is working fine as well!! Thank a ton!
=if(getselectedcount([Parent_Segment])>0,
aggr(only([Parent_Segment]),[Parent_Segment]),if(getselectedcount(Segment)>0,
Segment
))