Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to fetch records in Table format based on "OR" condition between two visual filters in Qlik sense
In Above Image , Left side (Table A) is input data and Right side is expected output based on Filters (State=Maharashtra; Publish Year=2022-02)
Hi, either in the load script ...
[Table A]:
LOAD State,
[Publish Year]
FROM
Where State = 'Maharashtra' or [Publish Year] = '2022-02' ;
Or with this, while hiding the expression column under the presentation tab
=Count(DISTINCT{$<State={'Maharashtra'}>+<[Publish Year]={'2022-02'}>} State & [Publish Year])
Thanks @BrunPierre ,
Here, user will select the filter values on run time. Just for understanding the example here, I have selected value as "Maharashtra" and "2022-02". But Ideally user will select these filter values from Filter Pane (Drop down Multiselect Filter)
Also If I use this hardcoded filter in Load Script, then I will not be able to load complete data from table. It will load data only for State = 'Maharashtra' or [Publish Year] = '2022-02'
Assuming field selection is mandatory (not selecting a value in the context of OR means selecting all values, after all), I would set up an island table for each of these filters and then use a set along the lines of the below.
Load * INLINE [
Dim, Measure
A, 1
A, 2
B, 3
C, 4
C, 5
C, 6
D, 7
D, 8
];
Load * INLINE [
Dim1
A
B
C
D
];
Load * INLINE [
Measure1
1
2
3
4
5
6
7
8
];
Count({ <Dim = p(Dim1)>+<Measure = p(Measure1)> } Measure)
Thanks @Or
But here my use case is something different. Can you please check and let me know if you have any solution.
Unfortunately, since you haven't explained why this does not work for you, I have no idea what else might work for your specific use case. The solution suggested should work for the situation you described in your original point, and generally speaking, it is neutral to pretty much everything else in your app so it's hard for me to think of a use case it would not apply to.
If your issue is with the island tables, you could consider using either variables or multiple states instead, but the end solution would be the same.