Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
KommulaRahul
Contributor III
Contributor III

Conditional formatting

I'm working on one logic. 

IMG_20240514_194112.jpg

 As u can see in the above pic, 

The third column shows values in orange color. 

The logic is 

If(DailyReportDim=[Orders Category] and $(vDailyReportValues%) < if(DailyReportDim=[Orders Category], [Threshold Start])  & '%', 'red', 

If(DailyReportDim=[Orders Category] and $(vDailyReportValues%) > if(DailyReportDim=[Orders Category], [Threshold End] & '%', 'green', 'orange'

)) 

But it is giving only orange color . Executing only the else condition. 

Can anyone check this out

And come up with a proper logic 

 

Labels (1)
4 Replies
Vegar
MVP
MVP

The reason you get orange is because neither 

DailyReportDim=[Orders Category] and $(vDailyReportValues%) < if(DailyReportDim=[Orders Category], [Threshold Start])  & '%'

 

nor 

DailyReportDim=[Orders Category] and $(vDailyReportValues%) > if(DailyReportDim=[Orders Category], [Threshold End] & '%'

 

returns true for any row. I suggest you take a look at the different elements of those if statements in order to verify that you get the output from them as you expect.

 

Also check that the parenthesis are set correctly. I suspect you have at least one misplaced paranthesis. 

Vegar_0-1715715162121.png

 

joshsiddle8
Contributor III
Contributor III

The reason you're getting orange is because neither of the conditions:

scss
Copy code
DailyReportDim=[Orders Category] and $(vDailyReportValues%) < if(DailyReportDim=[Orders Category], [Threshold Start]) & '%'
nor

css
Copy code
DailyReportDim=[Orders Category] and $(vDailyReportValues%) > if(DailyReportDim=[Orders Category], [Threshold End] & '%'
returns true for any row. I recommend examining each element of these if statements to ensure they produce the expected output.

Additionally, double-check that the parentheses are correctly positioned. It's possible you have at least one misplaced parenthesis.

 

 

 

KommulaRahul
Contributor III
Contributor III
Author

I corrected that parenthesis. 

Actual requirement is 

If the column(DailyReportValues%) values are 

Within threshold start and threshold end 

It must show orange color

If it is below threshold start-red color

Above threshold end-green color. 

Can we write this logic in any other way than if condition

KommulaRahul
Contributor III
Contributor III
Author

I got the solution

Anyway thanks.