Forum Discussion
Vatz8
3 years agoHelper I
Using if statement with date condition to choose between two measures in different tables.
Hi, I have two measures in two different table lets say Table 1 and Table 2. I have created a matrix table with Table 1 - Measure as value field. However, now we have received a data table (Table 2)...
- Anonymous3 years ago
Hi Vatz8 ,
According to your statement, I think there should be both [Date] columns in 'Table 1' and 'Table 2'. Here I suggest you to create a DimDate table by CALENDAR() or CALENDARAUTO() function.
Table1:
Table2:
Measure:
Measure = VAR _ADD = ADDCOLUMNS ( DimDate, "IF", VAR _DATE = DATE ( 2023, 01, 20 ) RETURN IF ( DimDate[Date] > _DATE, [Measure 2], [Measure 1] ) ) RETURN SUMX ( _ADD, [IF] )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Wheezy
3 years agoRegular Visitor
What if you try the next measure:
IF(
SELECTEDVALUE([Date_Column]) > DATE(2023, 01, 20),
[Measure2],
[Measure1]
)