Forum Discussion
Excellove15
Sep 27, 2024Iron Contributor
Combining Two dax measures to avoid dax reference
Hi Team,
I have created two dax codes as below:
Related_(Target cost)_1 =
VAR TargetValue =
CALCULATE (
SUM ( Target[Value] ),
'Target'[DBName-Point_id] = MAX ( 'Accruals'[DBName-Point_Id] )
&& 'Target'[TargetType] = 1
&& 'Target'[month] = FORMAT ( MAX ( 'Accruals'[Date] ), "mmmm" )
)
VAR days =
SUMX ( 'Accruals', TargetValue )
RETURN
--days/[no of days]
COALESCE ( days / [no of days], 0 )Target cost_1 =
SUMX ( 'Accruals', COALESCE ( [Related_(Target cost)_1], 0 ) )
Their results individually as shown below
Is it possible to merge these dax measures into a single dax ? Also, final values at the total & column will be same as below ?
I am doing this in order to avoid the reference of measures within another dax.
Please help me.
Thanks in advance!
2 Replies
- LiamStormIron Contributor
Sometimes, you may want to avoid a circular reference without creating separate measures. You can use variables within your DAX measure to store intermediate calculations.
- VaughnPierceIron Contributor
It seems you want to combine two DAX measures into a single measure in order to avoid DAX reference issues.