Forum Discussion
Anonymous
6 years agoNot applicable
IF Condition result
Hello guys,
I have a formula that is something like this:
RoadmapStart =
IF(
IF(
Roadmap[Aux] = "ROM",
Roadmap[ROM Start].[Date],
Roadmap[In Progress Start].[Date]
) < DATE(2020,01,01),
DATE(2020,01,01),
IF(
Roadmap[Aux] = "ROM",
Roadmap[ROM Start].[Date],
Roadmap[In Progress Start].[Date]
)
)
I was wondering if there is a "fancy" way to write the same thing, like using the result of the second if as a result. That would look something like this:
RoadmapStart =
IF(
IF(
Roadmap[Aux] = "ROM",
Roadmap[ROM Start].[Date],
Roadmap[In Progress Start].[Date]
) < DATE(2020,01,01),
DATE(2020,01,01),
Result // Value
)
Thanks in advance,
- In this case, you could try variables:
Column=
VAR _Date = IF(
Roadmap[Aux] = "ROM",
Roadmap[ROM Start].[Date],
Roadmap[In Progress Start].[Date]
)
RETURN
IF(
_Date < DATE(2020,01,01),
DATE(2020,01,01),
_Date
)
Note though that variables are calculated when they are defined, not when they are used, so in some measures this can change their context. (not needed for this one, but good to know for future).
1 Reply
- AllisonKennedy
Community Champion
In this case, you could try variables:
Column=
VAR _Date = IF(
Roadmap[Aux] = "ROM",
Roadmap[ROM Start].[Date],
Roadmap[In Progress Start].[Date]
)
RETURN
IF(
_Date < DATE(2020,01,01),
DATE(2020,01,01),
_Date
)
Note though that variables are calculated when they are defined, not when they are used, so in some measures this can change their context. (not needed for this one, but good to know for future).