Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
William_Wistam
Contributor III
Contributor III

Unusual Expression Parsing with // (Comment) and Line Breaks in Qlik Sense SaaS - Possible Bug?

Hello Qlik Community,

I've encountered a very peculiar behavior with an expression in Qlik Sense SaaS that seems to defy standard parsing rules and might indicate a bug. I'm hoping to get some insight, confirmation, or a potential explanation for this.

The Goal:

I'm trying to calculate the sum of Revenue for a specific Period defined by a variable vMaxPeriod, using the TOTAL qualifier to get a grand total (disregarding chart dimensions).

The Working Expression (Surprisingly):

My expression only works when structured exactly like this, including the // (comment) characters and specific line breaks:

Code snippet
 
Sum({$<Period={$(vMaxPeriod)}>} //
    TOTAL [GL_Hub]
    Revenue)

Key Observations for the Working Expression:

  1. The // (comment characters) are present on the line immediately after the closing curly brace of the set analysis (}).
  2. TOTAL [GL_Hub] and Revenue) are on separate lines, following the line with the // comment.

The Problem: Expressions That Don't Work (and why they should according to documentation):

If I remove the // comment, or if I consolidate TOTAL [GL_Hub] Revenue onto a single line after the set analysis, the expression breaks and returns an error.

  1. Removing // (should work if // were just a comment):

    Code snippet
     
    Sum({$<Period={$(vMaxPeriod)}>}
        TOTAL [GL_Hub]
        Revenue)
    • Result: Does not work. This suggests the // is serving a functional purpose beyond just being a comment.
  2. Consolidating TOTAL and Field on one line (standard recommended syntax):

    Code snippet
     
    Sum({$<Period={$(vMaxPeriod)}>} TOTAL [GL_Hub] Revenue)
    • Result: Does not work. This is particularly confusing, as this syntax (Sum({SetAnalysis} TOTAL Field)) is generally the recommended way to get a grand total with set analysis in Qlik Sense.

My Environment:

  • Qlik Sense SaaS (Cloud)

My Question to the Community:

  • Has anyone else experienced this kind of behavior where a // comment seems to be functionally required for an expression to parse correctly?
  • Is there a documented reason for // to act as a "soft line break" or continuation marker in this specific scenario?
  • Is this a known bug in Qlik Sense SaaS, or am I missing a fundamental parsing rule specific to my environment?

I've verified that $(vMaxPeriod) resolves correctly to a valid period value and that [GL_Hub] Revenue is the correct field reference. The issue consistently lies with the presence/absence of // and the specific line breaks.

Any insights or similar experiences would be greatly appreciated!

Thank you,

Will

 

Labels (1)
  • SaaS

10 Replies
William_Wistam
Contributor III
Contributor III
Author

Thanks for the detailed explanation! I appreciate the clarification on how TOTAL works. That was my goal using TOTAL with GL_Hub, where GL_Hub is our branch/business location—I should have renamed it to avoid confusion in the first place. The goal of TOTAL <GL_Hub> was to make the expression still responsive when a user selected a branch/location, it seems like Ruben's solution by removing <GL_Hub> from TOTAL still allow the user to select the location and the number update properly which the behaviour I want, not showing the total of all locations, but a single location or multiple locations that the user selected across any period of time. For example, when the user typed 202506 in the input box, it will compare the revenue of 202506 with all other periods/months to show the increase/decrease of revenue compared to 202506 across all available periods in the dataset. Maybe I just overcomplicate what I tried to achieve, but essentially my boss wants to see how this period/month (e.g., 202506) compares to any other months. Of course, the application of this is not only limited to Period/Month, but any other comparison; the user-defined input box will allow users to set the benchmark, like setting up a goal/target, but instead of a static goal, it's a dynamic goal based on the value of the dimension that the user selected. I agree that using the // (comment) is not right; I just didn't know how to fix it or remove it until I saw Ruben's last response.
 
Thank you!
Will