Forum Discussion
Allselected doesn't work on a table variable
Hi. I have a table variable consisting of
calculate(sumx(TotalTime, [Duration]), allselected())
5 Replies
- Jihwan_KimSuper User
Hi,
I am not sure how your semantic model looks like, but please try something like below whether it suits your requirement.
VAR TotalTime = SUMMARIZE ( ADDCOLUMNS ( SUMMARIZE ( Tbl1, Tbl1[ID], calendar[Date] ), "Duration", CALCULATE ( SUM ( Tbl1[duration] ), t2_Dim[status] <> "Complete", ALLSELECTED ( calendar ) ) ), Tbl1[ID], [Duration] )- yasbosResolver II
Hi. Thanks. Unfirtunately, it is not the calendar that is an issue. The whole measure works fine without a table variable. It's the variable that causes it to malfunction. I don't undredtand why. I didn't break lineage.
- AnonymousNot applicable
Hi yasbos ,
I can't understand you clearly, but I made some attempts. The unique value case you are talking about is misplaced measure.
T1 ALL = CALCULATE(SUMX('T1','T1'[value]),ALLSELECTED('T1'[ID])) VT ALL = CALCULATE(SUMX('VT','VT'[Duration]),ALLSELECTED('VT'[ID]))Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- yasbosResolver II
Thanks for trying, Anonymous . I see you created a calculated table. I can't create calculated tables because I aork with an analysis services tabular model. I can't create columns or calculated tables. However, my question is specific to table variables that are created within the measure for use within the measure only. What I'm sayin is that, it seems that allselected does not work on table variables. The code works fine if I doen't use table variables. My question was whether I was not doing it correctly, and if there is a way to be able to use allselected on a table variable. Thanks.
- AnonymousNot applicable
Hi yasbos ,
Could you provide me with a sample data that maps the structure of your data, I'd like to try it out.
Best regards,
Community Support Team_ Scott Chang