Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I try to do a sum with set analysis and variables.
Here my code :
Sum({$<PERIODE={$(test1)}>}[VM])
+
Sum({$<PERIODE={$(test2)}>}[VM])
In test1, I have :
=SubField(GetFieldSelections(PERIODE), ',' ,1)
in test2, I have :
=SubField(GetFieldSelections(PERIODE), ',' ,2)
If I do only Sum({$<PERIODE={$(test1)}>}[VM]) then it works, but if I add second sum, it put me error.
How can I solve it please.
Thanks in advance
If the calculation works with the fist variable, probably the evaluation of the second one is returning something that is causing the problem, there is something that =SubField(GetFieldSelections(PERIODE), ',' ,2) is returning that is not working fine, if you using this in a text table, instead of using =SubField(GetFieldSelections(PERIODE), ',' ,2) as part of a calculation, just create another measure with that calculation (=SubField(GetFieldSelections(PERIODE), ',' ,2)) so you can see what is being returned and identify what is braking the calculation.
Hope it helps.
enclose in single quotes, also you must ensure there are always at least 2 selected values in PERIODE field
Sum({$<PERIODE={'$(=test1)'}>}[VM])
+
Sum({$<PERIODE={'$(=test2)'}>}[VM])