Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am building a Qlik Sense Extension that has two dimensions and two measures. What I need is that the measure one values should be calculated on unique combination of values of both the dimensions (which is the default behavior), but measure two values should be calculated on unique values of only dimension one.
So for example, if my data is:
A | B | C |
1 | 2 | 10 |
1 | 2 | 10 |
1 | 3 | 10 |
4 | 5 | 10 |
And I chose dimension 1 as "A", dimension 2 as "B" and both measures as sum of "C", then in my extension, "layout.qHyperCube.qDataPages[0].qMatrix" should return the following table.
dimension1 | dimension2 | measure1 | measure2 |
1 | 2 | 20 | 30 |
1 | 3 | 10 | 30 |
4 | 5 | 10 | 10 |
It has one row per unique combination of values of dimension1 and dimension2. The measure1 is calculated on each unique combination of values of dimension1 and dimension2 (which is the default behavior). The measure2 is what I need help with. It should be calculated on each unique values of just dimension1 (and dimension2 should be ignored).
Is this possible. If so, how?
I didn't quite follow your descriptive text, but I think I'm able to help you to calculate your desired output anyhow.
See attahed picture and script below.
LOAD recno() as RecNo, * Inline [
A B C
1 2 5
1 2 5
1 3 5
] (delimiter is ' ');
Thanks for the reply @Vegar .
I have updated my original post to better explain what I need.
I want to solve it in the extension code if possible and not in load script of app.