Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

byrnel0586
Contributor

Show result as a negative value

Hi,

I have this expression which (technically) gives me the correct value I need.

if(match(Aggr($(vStarWeight),Star,MeasureID,Region_DESC),1),$(vStar2),null())

However, there are certain instances where I would need this value to show as negative. Or even simply with a '-' in front of the number. For example, if(match(MeasureID,'CDC2_HBAPOOR','PartD_HRM','PCR2') is when I would need the expression to show as negative.

How can I modify this expression to show either a '-' or a negative number value for those MeasureIDs ('CDC2_HBAPOOR','PartD_HRM','PCR2')?

Any help is appreciated!

2 Replies
santiago_respane
Valued Contributor

Re: Show result as a negative value

Hi,

maybe this is a possible solution:

if(match(MeasureID,'CDC2_HBAPOOR','PartD_HRM','PCR2'),

  if(match(Aggr($(vStarWeight),Star,MeasureID,Region_DESC),1),$(vStar2) * -1,null()),

  if(match(Aggr($(vStarWeight),Star,MeasureID,Region_DESC),1),$(vStar2),null())

  )

Please let me know if this helps.

Kind regards,

datalakeyu
Valued Contributor

Re: Show result as a negative value

Please try:

if(match(Aggr($(vStarWeight),Star,MeasureID,Region_DESC),1),

if ([MeasureID] = 'CDC2_HBAPOOR' or 'PartD_HRM' or 'PCR2', $(vStar2)*-1, $(vStar2) ),

null() 

   )