Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
stanciuc
Contributor II
Contributor II

How to repeat a value for the rest of the rows?

Hello,

I'm new to Qlik and I'm having a trouble with a column.

I have input box with a variable where the user can select a month (JAN, FEB, MAR...)

I have the table with all the information(below is a sample).

I would like to show in the CM column only the amount of the selected month.

AID RID Date Count Month CM
A 1 01/02/2023 3  
A 1 01/05/2023 3  
A 1 01/11/2023 3  
B 2 05/02/2023 2  
B 2 05/07/2023 2  
C 3 10/01/2023 1  

 

If the user selects JAN the CM will be filled with 3.

AID RID Date Count Month CM
A 1 01/02/2023 3 3
A 1 01/05/2023 3 3
A 1 01/11/2023 3 3
B 2 05/02/2023 2 3
B 2 05/07/2023 2 3
C 3 10/01/2023 1 3

 

If the user will select FEB it will display 0 or if  OCT it will display 1.

Is there a way to make an expression for this? Thank you.

1 Solution

Accepted Solutions
joaopaulo_delco
Partner - Creator III
Partner - Creator III

Hi @stanciuc !

          Try to follow the steps below:

1) In the script section add a new field like below:

Upper(Month(Date)) as Month, 

joaopaulo_delco_0-1689271582839.png

2) Add two variables like the screenshot below:

joaopaulo_delco_1-1689271645901.png

vVarMonth with a blank expression

vVarCM with the expression =Max({<Month={"$(vVarMonth)"}>}[Count Month])

3) Add the vVarCM variable as a column with the expression $(vVarCM).

 

joaopaulo_delco_2-1689271919108.png

 

 

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

4 Replies
joaopaulo_delco
Partner - Creator III
Partner - Creator III

Hi @stanciuc !

          Try to follow the steps below:

1) In the script section add a new field like below:

Upper(Month(Date)) as Month, 

joaopaulo_delco_0-1689271582839.png

2) Add two variables like the screenshot below:

joaopaulo_delco_1-1689271645901.png

vVarMonth with a blank expression

vVarCM with the expression =Max({<Month={"$(vVarMonth)"}>}[Count Month])

3) Add the vVarCM variable as a column with the expression $(vVarCM).

 

joaopaulo_delco_2-1689271919108.png

 

 

Help users find answers! Don't forget to mark a solution that worked for you!
stanciuc
Contributor II
Contributor II
Author

Hi joaopaulo_delco,

I tried the solution and it works partially for me.

It shows the count of the month but at the same time it eliminates all the rows with the different months.

If I select FEB it will show the count but display only the rows that have month = 'FEB'.

 

 

joaopaulo_delco
Partner - Creator III
Partner - Creator III

@stanciuc , I think you missed putting the equal "=" sign at the beginning of the expression definition to vVarCM variable.

joaopaulo_delco_0-1689276396563.png

 

 

Help users find answers! Don't forget to mark a solution that worked for you!
stanciuc
Contributor II
Contributor II
Author

Hi Joaopaulo_delco,

That solved the issue! Thank you!