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: 
byrnel0586
Creator
Creator

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
Specialist
Specialist

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,

Anonymous
Not applicable

Please try:

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

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

null() 

   )