Forum Discussion
jonbox
Helper II
4 years agoCombine two columns based on condition
Hi, I have a dax formula to create a new column based on a condition.
the logic is simply If day == today, use a certain value from one column up until that day, otherwise use another value from another column.
Unfortunately it doesnt actually combine the columns into 1.
Spend + Prediction =
VAR _monthtoday =
MONTH ( TODAY () )
VAR _yeartoday =
YEAR ( TODAY() )
VAR _month_table =
MONTH ('Actual Spend + Firm'[Actual Month-Year] )
VAR _year_table =
YEAR ('Actual Spend + Firm'[Actual Month-Year] )
RETURN
IF (
_month_table >= _monthtoday
&& _year_table >= _yeartoday ,
'Actual Spend + Firm'[ActualPrediction_Loc 2], +
'Actual Spend + Firm'[ActualSpending_Loc]
)The table below is the result of the above code, which is correct:
The problem occurs when i want to put this data into a graph:
as you can see it splits the columns still whereas in the table above it just uses the one.
Any help with this please?
1 Reply
- amitchandak
Super User
jonbox , not very clear . But id should be like
if(max('Date'[Date]) <today(), [measure1], [Measure2])
for comparing month use eomonth([date],0) = eomonth(today(),0)