Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Hi @stanciuc !
Try to follow the steps below:
1) In the script section add a new field like below:
Upper(Month(Date)) as Month,
2) Add two variables like the screenshot below:
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).
Hi @stanciuc !
Try to follow the steps below:
1) In the script section add a new field like below:
Upper(Month(Date)) as Month,
2) Add two variables like the screenshot below:
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).
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'.
@stanciuc , I think you missed putting the equal "=" sign at the beginning of the expression definition to vVarCM variable.