Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
jacekp
Contributor
Contributor

Value List & measure

Hi,

I would like to have 3 different calculation based on the dimension in Valuelist:

Dimension:

ValueList('A','B','C')

Measure:

=if(ValueList('A','B','C')='A', 1,
if(ValueList('A','B','C')='B',[Demand_DOS_>0<=14]
,[Demand_DOS_>14<=45]))

I am using master measures to get it clean. 

Individual master measures work fine and return correct numbers.

[Demand_DOS_>0<=14] = 100

[Demand_DOS_>14<=45] = 50

I don't get this behaviour: 

a) if "measure" looks like that, returns table:

=if(ValueList('A','B','C')='A', 1,
if(ValueList('A','B','C')='B',[Demand_DOS_>0<=14]
,[Demand_DOS_>14<=45]))

A =1

B=0

C=0

b) if measure looks like that, returns table:

=if(ValueList('A','B','C')='A', [Demand_DOS_>0<=14],
if(ValueList('A','B','C')='B',1
,[Demand_DOS_>14<=45]))

A = 100

B = 1

C = 0

Seems like master measure works only on first condition, if it is on another place it won't work

Can someone suggest any workaround ?

 

Labels (1)
4 Replies
Chanty4u
MVP
MVP

Try this 

 

=if(ValueList('A','B','C')='A', 1,

if(ValueList('A','B','C')='C',[Demand_DOS_>14<=45],

[Demand_DOS_>0<=14]

))

jacekp
Contributor
Contributor
Author

It returns:

A = 1

B = 0

C = 0

Chanty4u
MVP
MVP

Can you try this 

=if(ValueList('A','B','C')='A', 1,

if(ValueList('A','B','C')='B',[Demand_DOS_>0<=14],

if(ValueList('A','B','C')='C',[Demand_DOS_>14<=45], 0)

))

jacekp
Contributor
Contributor
Author

still returns only A = 1, B & C = 0

master measure looks like that:

sum(
{<
    Date = {"$(vD_Month_N6M)"}
>}
 
aggr(
 
if(
(
Sum(
{<
   
  Presentation = {"AC Unrestricted","InTransit"}
 
 
>}
Value)
  
/  
(  
  Sum(
{<
    Date = {"$(vD_Month_N6M)"},
  ValueType = {"Demand"}
 
 
>}
$(vValue))
/6
))
*30
>0
 
and
 
(
Sum(
{<
  
  Presentation = {"AC Unrestricted","InTransit"}
 
 
>}
Value)
  
/  
(  
  Sum(
{<
    Date = {"$(vD_Month_N6M)"},
  ValueType = {"Demand"}
 
 
>}
$(vValue))
/6
))
*30
<=14
,
 
Sum({<Date = {"$(vD_Month_N6M)"},ValueType = {"Demand"}>}$(vValue)),0)
,[Material ID]))