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

How make a data range for a calculated measure field?

Hi there!

I have a doubt, I Have a table with 4 fields, all are from the original table.

| Product | Region | Sum of Product | Sum for Total Region |

In addition of this, I made a calculated measure field in which I'm calculating a percentage from the [ Sum for Total Region ] with the next function:

calculated measure field [% From Total] =  [ Sum of Product ] / [ Sum for Total Region ] = % from the Sum for Total Region

Then I have my table with 4 original fields and 1 as a calculated measure:

| Product | Region | Sum of Product | Sum for Total Region | % From Total |

My doubt is: How could I make a new field [ Class ] to get a classification from my calculate measure field as such as I want:

| % From Total | Class |

If the result in the camp % From Total >= 0% and <=40% then is Bad

If the result in the camp % From Total >= 41% and <=70% then is Regular

If the result in the camp % From Total >= 71% and <=100% then is Good

For Example:

| % From Total | Class   |

|          52.48%  | Regular |

|          79.99%  | Good    |

....


I hope you could help me.


Greetings


Luis

6 Replies
hcabrera
Contributor III
Contributor III

Hi Luis,

You can create a new calculated measure field  [Class] with:


=if([% From Total] <= 40, 'Bad', if([% From Total] <= 70,'Regular', if([% From Total] <= 100,'Good')))

sujeetsingh
Master III
Master III

I assume that this is in script. Just use resident load or preceding load to get the classes created on the calculated column.

luisdarwinqlik
Contributor II
Contributor II
Author

Hi Henry, I tried to do it, but in the master dimension the code doesn't recognize the field.  It say: Camp [% ...] is not valid.


How can I make reference to this measure?


Greetings!

luisdarwinqlik
Contributor II
Contributor II
Author

Hi Sujeet, I was trying to load in the script, but I don't know there how I can calculate the measure between the two columns.


Greetings

Not applicable

Did you find a solution for this ? I have a similar requirement.

luisdarwinqlik
Contributor II
Contributor II
Author

Hi Deepika TR,

No yet, I've been trying to do it but I can't get the result I want...

Do you have any idea, maybe someone can read us and will catch it...

Regards

Luis