Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all!
Fairly new to Qlik and managed to write quite a complex expression that works and returns the results I need however I am sure that there must be a way of maybe streamlining this expression or making it more efficient.
Please let me know if you have any suggestions on what can be done or feel free to amend accordingly. I have attached the Expression - I copied it into a word doc.
Thanks!
There probably is, but for a more detailed response you will need to create a small sample qvw or qvf file with some representative data so that modifications can be tested.
Some tips:
This component
SUM({<
[Metric]={"Income"},
[Year] ={'$(=$(v_CurrentYear))'},
[Month] ={"Jan"}
>}[Actual]) +
SUM({<
[Metric]={"Income"},
[Year] = {'$(=$(v_CurrentYear))'},
[Month] ={"Jan"}
>}[Outlook])
Could be replaced with
SUM({<
Metric = {'Income'},
Year = {$(v_CurrentYear)},
Month] = {'Jan'}
>} RangeSum(Actual, Outlook))
There are other places where you could do the same (same set expression). RangeSum() handles nulls and missing values correctly.
Use single quotes in set expressions for literals. Use double quotes for search expressions. Use no quotes for simple numbers (like year). These may not matter on older versions of Qlik, but they do matter moving forward.
Avoiding unnecessary decoration (like fields in square brackets) makes expressions easier to read and maintain.
There probably is, but for a more detailed response you will need to create a small sample qvw or qvf file with some representative data so that modifications can be tested.
Some tips:
This component
SUM({<
[Metric]={"Income"},
[Year] ={'$(=$(v_CurrentYear))'},
[Month] ={"Jan"}
>}[Actual]) +
SUM({<
[Metric]={"Income"},
[Year] = {'$(=$(v_CurrentYear))'},
[Month] ={"Jan"}
>}[Outlook])
Could be replaced with
SUM({<
Metric = {'Income'},
Year = {$(v_CurrentYear)},
Month] = {'Jan'}
>} RangeSum(Actual, Outlook))
There are other places where you could do the same (same set expression). RangeSum() handles nulls and missing values correctly.
Use single quotes in set expressions for literals. Use double quotes for search expressions. Use no quotes for simple numbers (like year). These may not matter on older versions of Qlik, but they do matter moving forward.
Avoiding unnecessary decoration (like fields in square brackets) makes expressions easier to read and maintain.