Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
hwange3
Contributor
Contributor

How can I show the same value for each month?

My table has two values, either $1,000 or $0 for each month. I would like every month to show the same value ($1,000) through expression.

September    $1,000

October    $1,000

November    $0

December    $0

January    $1,000

How can I get November and December to also show $1,000.

Thanks in advance!

1 Solution

Accepted Solutions
hwange3
Contributor
Contributor
Author

Thanks Chanty4u and Vegar for your suggestion! 

The amounts will be different for different accounts, so I would like an expression that would change accordingly. 

I was able to do a max on an aggregate by using the aggr function to aggregate on the month. 

max(TOTAL aggr(sum(distinct Amount), Month))

View solution in original post

3 Replies
Chanty4u
MVP
MVP

can you try this?

test:
LOAD * INLINE [
Month,amount
September, "$1,000"
October, "$1,000"
November, $0
December, $0
January, "$1,000"
];

result:

load * ,

if(amount='$0','$1,000',amount) as New Resident test;
DROP Table test;
exit SCRIPT;

month.PNG

Vegar
MVP
MVP

What is the logic? Is it a static $1000 you want? If so you could just write $1000 in your expression rather than using the amount field.

Or so you have situations where you do want to present $0?

Another expression that could help without any needs for script edits is:

=max(TOTAL [Amount field]) 

hwange3
Contributor
Contributor
Author

Thanks Chanty4u and Vegar for your suggestion! 

The amounts will be different for different accounts, so I would like an expression that would change accordingly. 

I was able to do a max on an aggregate by using the aggr function to aggregate on the month. 

max(TOTAL aggr(sum(distinct Amount), Month))