Forum Discussion
SELECTEDVALUE inside table constructor
- 1 year ago
Alex_Sawdo, ALLSELECTED isn't necessarily what you want (though it might be in some cases).
I'd suggest one of the following instead:
CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[ItemName] IN VALUES ( 'ParameterTable'[ItmNam] ) )CALCULATE ( COUNTROWS ( 'Table' ), TREATAS ( VALUES ( 'ParameterTable'[ItmNam] ), 'Table'[ItemName] ) )This doesn't really answer OP's question though.
juan_pablo, in my testing, the first measure does do what you're expecting if a single parameter value is selected.
Thanks for the sample file.
There's something going on here that I don't understand and in my digging I found this related result that I'm leaving as a note for my future self:
EVALUATE
SUMMARIZECOLUMNS (
Category[ItmsGrpNam],
TREATAS ( { "Viaka" }, 'Categoria Obj 1'[ItmsGrpNam] ),
TREATAS ( { "Activos" }, Category[ItmsGrpNam] ),
"V1", /*Returns Viaka*/
CALCULATE (
MAX ( Category[ItmsGrpNam] ),
KEEPFILTERS (
Category[ItmsGrpNam] = MAX ( 'Categoria Obj 1'[ItmsGrpNam] )
)
),
"V2", /*Returns Blank*/
CALCULATE (
MAX ( Category[ItmsGrpNam] ),
KEEPFILTERS (
FILTER (
ALL ( Category[ItmsGrpNam] ),
Category[ItmsGrpNam] = MAX ( 'Categoria Obj 1'[ItmsGrpNam] )
)
)
),
"V3", /*Returns Blank*/
CALCULATE (
MAX ( Category[ItmsGrpNam] ),
KEEPFILTERS (
Category[ItmsGrpNam] = VALUES ( 'Categoria Obj 1'[ItmsGrpNam] )
)
)
)
I'm not sure why V1 doesn't match V2 or V3. marcorusso, can you help explain what's going on here?
AlexisOlson I got blank for the three columns. It could be that I'm using an updated version - try again with the October 2024 release when available, and let me know if you can still reproduce the issue.