'Need an advise with Power Bi function DATEADD

How can i create mesure like that: If email_name = '1' add 4 days to some_value , If email_name = '2' to some_value.

So i think the idea is clear. Sorry for my English.



Solution 1:[1]

Because I imagine you are wanting to do an IF condition row-by-row, you'd be much better served by creating a calculated column as opposed to a measure. In any case, your DAX for the calculated column would look something like this:

New Col =
SWITCH(
    [email_name],
    '1', [some_date_value] + 4,
    '2', [some_date_value] + ?, // Your statement was not clear here...
    <value to return in all other cases here>
)

I recommend a SWITCH statement here so as to aviod the nuisance of building nested IF statements. Keep in mind that your [some_date_value] column will need to be the data type of date or numeric so that Power BI can add the days.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 codyho