Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
TomBond77
Specialist
Specialist

Text color expression

Hi experts

I try to change the text color via an IF condition:

=if(

Budget = 'Yearly' and Calendar.MonthNum='12',   white(), black()

)

But this code is ignoring the case if MonthNum is 12. Any ideas?

Thanks, Tom

Labels (5)
1 Solution

Accepted Solutions
QFabian
MVP
MVP

@TomBond77 , what about this?

Data:
Load * INLINE [
Calendar.MonthNum, Amount, Type
1, 100,a
2, 50,b
3,100,a
4,50,a
5,10,a
6,50,b
7,100,b
8,50,b
9,100,a
10,50,b
11,30,a
12,40,b
];

exit script;

QFabian_0-1672929292856.png

QFabian_1-1672929310625.png

 

 

color :

=if(SubStringCount(Concat(Calendar.MonthNum, '|'), '12') > 0 , white(), black())

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.

View solution in original post

6 Replies
QFabian
MVP
MVP

Hi @TomBond77 , maybe this?

=if(

Budget = 'Yearly' and num(Calendar.MonthNum) = 12,   white(), black()

)

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
TomBond77
Specialist
Specialist
Author

Hi QFabian

There is a filter on MonthNum. If Jan up to Nov is filtered, the cell should be white. If the last month comes additionally into the filter the cell value should give black. Any ideas?

=if(Budget = 'Yearly' , if(num(Calendar.MonthNum)>=1 and Num(Calendar.MonthNum)<12 , white(), black()))

QFabian
MVP
MVP

@TomBond77  i made this example, and effectively, the row for 12 Month is black :

QFabian_0-1672926618251.png

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
TomBond77
Specialist
Specialist
Author

This only works if MonthNum is an element of the table, etc. Our filter is based on dimension Month (like Jan, Feb, ...Dec). Is there another function to use Calendar.Month as dimension?

QFabian
MVP
MVP

@TomBond77 , what about this?

Data:
Load * INLINE [
Calendar.MonthNum, Amount, Type
1, 100,a
2, 50,b
3,100,a
4,50,a
5,10,a
6,50,b
7,100,b
8,50,b
9,100,a
10,50,b
11,30,a
12,40,b
];

exit script;

QFabian_0-1672929292856.png

QFabian_1-1672929310625.png

 

 

color :

=if(SubStringCount(Concat(Calendar.MonthNum, '|'), '12') > 0 , white(), black())

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
TomBond77
Specialist
Specialist
Author

Thank, brilliant!