Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI all,
I want to change the labels name in the bar chart. so i have used the below query for dimensions.
IF(match(question_id, '1'), Replace(question_id, '1', 'Q1'),
IF(match(question_id, '2'), Replace(question_id, '2', 'Q2'),
IF(match(question_id, '3'), Replace(question_id, '3', 'Q3'),
IF(match(question_id, '4'), Replace(question_id, '4', 'Q4'),
IF(match(question_id, '5'), Replace(question_id, '5', 'Q5'),
IF(match(question_id, '6'), Replace(question_id, '6', 'Q6'),
IF(match(question_id, '7'), Replace(question_id, '7', 'Q7'),
IF(match(question_id, '8'), Replace(question_id, '8', 'Q8'),
IF(match(question_id, '9'), Replace(question_id, '9', 'Q9'),
IF(match(question_id, '10'), Replace(question_id, '10', 'Q10'),question_id))))))))))
To restrict the data to 10 bars i have used Limitation to "Fixed number".
But it is displaying some other question id's from the table.
Please see the image i have attached.
Thanks,
Pramod
Hi Pramod,
If you are always selecting the range of questions as 10 like 10-20, 20-30, 151-60, then use below solution.
LOAD
*,
'Q' & No AS Qno,
Q' & If(fmod(No , 10) = 0, 10, fmod(No , 10)) AS QNoMod
FROM DataSource;
Now use QNoMod as Dimension.
It is not a good practice to use Calculated dimension in the charts, it affects the performance issues and lot of other issues.
Also it is a good practice to share some sample file for sample data in community to get the answers quickly, people won't have time to prepare sample data, sample file and solution to give. If you provide sample data it saves lot of time and for better understanding.
Go through this link it helps you in getting the successful answers quickly.
Qlik Community Tip: Posting Successful Discussion Threads
Regards,
jagan.
Hi Pramod,
In script itself you can bring one new column with Qn number like below
LOAD
*,
'Q' & No AS Qno
FROM DataSource;
Now you can use this expression if you want to show Q1 to Q10.
=Sum({<Qno={'Q1', 'Q2','Q3','Q4','Q5','Q6','Q7','Q8','Q9','Q10'}>} MeasureName)
Regards,
Jagan.
Hi jagan,
The scenario is i have question_id's around 200 if i select question_id's from 151 to 160 at that time i don't want to display as Q151 to Q160. I need that also in Q1 to Q10 so i am using replace.
You can see in the below image.
Thanks,
Pramod
Hi Pramod,
I'm not 100% sure about your final output, but changing slightly Jagan's suggestion, please try the following:
In the script, create an additional field:
LOAD
*,
dual('Q' & No,No) AS Qno
FROM DataSource;
Then in the chart use this expression:
=Sum({<Qno={">=1<=10"}>} MeasureName)
If you want to "skip" the selection against Qno, then your expression should look like this:
=Sum({<Qno=, Qno={">=1=<10"}>} MeasureName)
Now if you select Qno betweeen 151 and 160 the other chart will still display number between 1 and 10.
I hope it will help.
Best regards,
Janusz
Hi Pramod,
If you are always selecting the range of questions as 10 like 10-20, 20-30, 151-60, then use below solution.
LOAD
*,
'Q' & No AS Qno,
Q' & If(fmod(No , 10) = 0, 10, fmod(No , 10)) AS QNoMod
FROM DataSource;
Now use QNoMod as Dimension.
It is not a good practice to use Calculated dimension in the charts, it affects the performance issues and lot of other issues.
Also it is a good practice to share some sample file for sample data in community to get the answers quickly, people won't have time to prepare sample data, sample file and solution to give. If you provide sample data it saves lot of time and for better understanding.
Go through this link it helps you in getting the successful answers quickly.
Qlik Community Tip: Posting Successful Discussion Threads
Regards,
jagan.
Hi jagan,
I have used the above load script but what expression should be used in dimension or measures to get the data.
please explain. I am attaching the sample data.
Thanks,
Pramod
You can use your current expression itself, no change in that just change the dimension in the chart to QNoMod.
Regards,
Jagan.
I used QNoMod in dimensions, but it is displaying only 5 values not 10 values.
Regards,
Pramod
I think there is issue with the data, check the data whether you have all the numbers from 1 to 10 for your selection.
Regards,
Jagan.
Yes, i have data for what i want.
For example: if i want display question_id from 151 to 160 it is printing with labels151 to 160. and data is also correct.
now just i want to change that labels from 151 - 160 to Q1 to Q10.
if i used the script given by you it's printing only Q1 to Q5.
Thanks,
Pramod