Forum Discussion
Anonymous
4 years agoNot applicable
Nested IF condition with ISFILTERED function.
I All, I have written DAX code like this: - Measure = if( ISFILTERED('optimisation'[BROADCASTER]),CALCULATE(DIVIDE ( [1], [2] ), ALL('optimisation'[LEVEL]),'optimisation'[LEVEL] = "BROADCASTER"),...
- 4 years ago
Hi Anonymous ,
You can try below code:-
Measure = VAR _series = CALCULATE ( DIVIDE ( [1], [2] ), ALL ( 'optimisation'[LEVEL] ), 'optimisation'[LEVEL] = "SERIES" ) VAR _broadcaster = CALCULATE ( DIVIDE ( [1], [2] ), ALL ( 'optimisation'[LEVEL] ), 'optimisation'[LEVEL] = "BROADCASTER" ) RETURN IF ( ISFILTERED ( 'optimisation'[SERIES] ), IF ( ISFILTERED ( 'optimisation'[BROADCASTER] ), _series ), IF ( ISFILTERED ( 'optimisation'[BROADCASTER] ), _broadcaster ) )Thanks,
Samarth
amitchandak
4 years agoSuper User
Anonymous , for second one both should be filtered and you need to have some data for 'optimisation'[LEVEL] = "SERIES"
If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Anonymous
4 years agoNot applicable
amitchandak HI Thanks for your reply, I tested my measure i selected first broadcaster then series in filter while selecting series in filter card showing me the "Blank".
I created separate measure for series and tested my values,
Selecting broadcaster then series it works for me
Measure 2 = if(ISFILTERED('optimisation'[BROADCASTER]) && ISFILTERED(
'optimisation'[SERIES]),CALCULATE(DIVIDE ( [1], [2] ),
ALL('optimisation[LEVEL]),'optimisation'[LEVEL] = "SERIES"))
But in nested if condition it is not working.
But in nested if condition it is not working.