Forum Discussion
Naveen_SV
Helper IV
4 years agoHow to write a Dax for after half year adding value based on 6th month
Hi Team, I have a requirement first half of the year my cost will remain same, but later secound half of the year my cost should add 6th month cost. Ex : month Cost ...
- 4 years ago
Hi Amit,
I tried with both like creating Measure and column also but i am getting same error.
new column =VAR _cost =MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Total Cost] )RETURNIF ( 'Table'[Month] > 6, _cost + 'Table'[Total Cost] )with measurenew measure =VAR _cost =MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Total Cost] )RETURNIF ( FILTER ( 'Table', 'Table'[Month] = 6 ), _cost, 'Table'[Total Cost] ) - 4 years ago
Hi Naveen_SV
Please create a new column with below code. PBIX is attached.
new cost = IF ( 'Table'[Month] > 6, MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Cost] ) + 'Table'[Cost], 'Table'[Cost] )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
amitchandak
Super User
4 years agoNaveen_SV , Try like
new column =
var _cost = maxx(filter(Table, [Month] =6), [Cost])
return
if([Month] >6 , _cost + [Cost], [Cost])
Naveen_SV
Helper IV
4 years agoHi Amit,
I tried with both like creating Measure and column also but i am getting same error.
new column =
VAR _cost =
MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Total Cost] )
RETURN
IF ( 'Table'[Month] > 6, _cost + 'Table'[Total Cost] )
with measure
new measure =
VAR _cost =
MAXX ( FILTER ( 'Table', 'Table'[Month] = 6 ), 'Table'[Total Cost] )
RETURN
IF ( FILTER ( 'Table', 'Table'[Month] = 6 ), _cost, 'Table'[Total Cost] )