Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi every one , Good Morning !
Today I need help in finding the field name of the expression. I created a
1) Bar Chart with
2) Dimension : a) Region
b) =if(Month1=2,'Feb',If(Month1=3,'Mar',if(Month1=4,'Apr',if(Month1=5,'May','Jun')))) [ Label = Month ]
both the dimension is grouped together and named as Group1.
3) Expression : Sum(Sales)
To get the result : I used =if(GetCurrentField([Group1])='Region','A',if(GetCurrentField([Group1])='Month1','B','C'))
but i did the result B .
Hi Sunny,
you can try with any data just keep month data in integer format as 1,2,3,4,5 etc in table or data set
and use the below formula in Dimension in chart: =if(Month1=2,'Feb',If(Month1=3,'Mar',if(Month1=4,'Apr',if(Month1=5,'May','Jun')))) Give label as ABC
now i want a text box where I want either name as Month or ABC when I select any month.( in sort field name not the expression )
Sorry, but don't have time to create a sample.... may be someone else might be able to help.
Best,
Sunny
Please find the attachment of sample table.
Please find attached.... My and another approach
My approach expression
=If(GetCurrentField([Group1]) = 'Region', 'A',
If(GetCurrentField([Group1]) = '=if(Month=2,''Feb'',If(Month=3,''Mar'',if(Month=4,''Apr'',''May'')))', 'B', 'C'))
Other approach expression
=If(GetCurrentField([Group2]) = 'Region', 'A',
If(GetCurrentField([Group2]) = 'MonthName', 'B', 'C'))
Where MonthName is created in script like this
LOAD *,
Month(Date#(Month, 'M')) as MonthName;
LOAD * INLINE [
Month, ProductCategory, Region, Country, Amount
1, Arts & Entertainment, North AMerica, USA, 1245
2, Hardware, South America, Brazil, 456
3, Home & Garden, South America, Brazil, 241
1, Food, South Asia, Singapore, 1247
2, Home & Garden, South Asia, China, 5462
4, Office Supplies, Australia, Australia, 577
];
I thought Marcus was suggesting this.... Sorry about that...
Hi Sunny,
The main trick was on script
Thanks again ,
but the expression part didn't worked
You have the expression in front of you... have you checked the file? Is it still not working for you?
Hi Sunny,
Please find the attachment of image and observe the text box.
I did not get the desired result.
Chart: Bar Chart
Dimension: Group1 ( Drill Down)
Expression: Sum(Amt)
So here is why it doesn't work...
Your actual if statement begins with Month = 1, but in your check you are doing Month = 2. For this to work, you need to have the exact same expression (with commas, spaces, upper and lower cases) of the text to match 100%. If even a single thing doesn't match the expression is not going to work.
Anyways, it seems like your issue is resolved now, so I would ask you to close this thread by marking the correct and any other helpful responses.
Qlik Community Tip: Marking Replies as Correct or Helpful
Best,
Sunny
Ok Sunny,
I change the expressions as per your request but still, i am facing the issue.
For every single quote you see, replace it with 2 single quotes
And replace these two single quotes or double quote with a single quote
Leave the single quotes around A and C as is... not change there.