Forum Discussion
create a calculated column while ignoring row context
- 9 years ago
Hi sf_,
Not like measures, calculate columns are computed during the database processing(e.g. data refresh) and then stored in the model, they do not response to user selections on the report. So I don't think this can be done with a calculate column in this case.:smileyhappy:
Regards
Hi sf_,
Could you try the formula below to see if it works in your scenario?:smileyhappy:
Is Included =
VAR selectedType =
CALCULATE (
FIRSTNONBLANK ( 'Table B'[type], 1 ),
FILTER (
ALL ( 'Table B' ),
'Table B'[Product] = FIRSTNONBLANK ( 'Table A'[product], 1 )
)
)
RETURN
IF (
ISFILTERED ( 'Table A'[Code] ),
IF (
FIRSTNONBLANK ( 'Table B'[Product], 1 )
= FIRSTNONBLANK ( 'Table A'[product], 1 )
|| FIRSTNONBLANK ( 'Table B'[type], 1 ) <> selectedType,
TRUE (),
FALSE ()
),
TRUE ()
)
Note: Make sure there is no any relationship between Table A and Table B.
Regards
- sf_9 years agoFrequent Visitor
Dear v-ljerr-msft
Thank you for the suggestion! This indeed works fine as a measure -- I managed to create a similar one with the same result --- but the problem is that I need a calculated column. Unfortunately, this does not work as a column:
Any ideas how to resolve that?
Best wishes and thank you again for your help!
- v-ljerr-msft9 years agoMicrosoft Employee
Hi sf_,
Not like measures, calculate columns are computed during the database processing(e.g. data refresh) and then stored in the model, they do not response to user selections on the report. So I don't think this can be done with a calculate column in this case.:smileyhappy:
Regards
- sf_9 years agoFrequent Visitor