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

How to compare 2 dimensions in expression

I have table like this.

Market Market Unit sales
Europe Europe 100
Europe UK 10
Europe Iberia 20
Europe Gallia 30
America North 30
America South 40
America America 120

 

I have two buttons Market and Market Unit.

When ever Market is selected, In a chart I want to show Average of records whose Market and Market Unit is same.

Market Market Unit NWD
Europe Europe 100
America America 120

 

 if Market Unit is selected, In a chart I want to show Average of records whose Market and Market Unit are not same

Market Market Unit NWD
Europe UK 10
Europe Iberia 20
Europe Gallia 30
America North 30
America South 40

 

Actually i want Overall, Market level and Market Unit Level, so i tried something like this but when ever i disable dimensionality values are not showing correct. If I keep the dimension enable it is also appearing the result/bar graph 

if(Dimensionality = 2, Sum([Chargeable hours])/Avg({$<Market = {'Result'}>}NWD),
if(Dimensionality = 3, Sum([Chargeable hours])/Avg({$<Flag = {1}>}NWD),
Sum([Chargeable hours])/Avg({$<Flag = {0}>}NWD)))

1 Solution

Accepted Solutions
MarcoWedel

One solution might be also:

QlikCommunity_Thread_t5_QlikView-App-Dev_How-to-compare-2-dimensions-in-expression_m-p_1858306_Pic2.png

 

QlikCommunity_Thread_t5_QlikView-App-Dev_How-to-compare-2-dimensions-in-expression_m-p_1858306_Pic1.png

 

tabSales:
LOAD Market, 
     [Market Unit],
     If(Market=[Market Unit],'Market','Market Unit')	as MarketUnitSwitch,
     sales
FROM [https://community.qlik.com/t5/QlikView-App-Dev/How-to-compare-2-dimensions-in-expression/m-p/1858306] (html, codepage is 1252, embedded labels, table is @1);

 

hope this helps

Marco

View solution in original post

3 Replies
abhijitnalekar
Specialist II
Specialist II

Hi @VENKY_A ,

Please check the attached QVW. 

Let me know if you are looking the same or not.

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!
MarcoWedel

One solution might be also:

QlikCommunity_Thread_t5_QlikView-App-Dev_How-to-compare-2-dimensions-in-expression_m-p_1858306_Pic2.png

 

QlikCommunity_Thread_t5_QlikView-App-Dev_How-to-compare-2-dimensions-in-expression_m-p_1858306_Pic1.png

 

tabSales:
LOAD Market, 
     [Market Unit],
     If(Market=[Market Unit],'Market','Market Unit')	as MarketUnitSwitch,
     sales
FROM [https://community.qlik.com/t5/QlikView-App-Dev/How-to-compare-2-dimensions-in-expression/m-p/1858306] (html, codepage is 1252, embedded labels, table is @1);

 

hope this helps

Marco

VENKY_A
Contributor II
Contributor II
Author

Hi Marko,

I used a similar approach before your post but that servers the purpose. thank you.

I'm maintaining flags to get my results appropriate.

if(Market = MarketUnit,2,Flag) as Flag,