Forum Discussion

siddrow's avatar
siddrow
Helper III
3 years ago
Solved

If else DAX statement in data modelling tab

Hi

 

I'm struggling to work out how to write a DAX formula for what I need.

 

I have a "Current Financial Year" column (created in data modelling tab) which is whole number format (e.g. 2023) and another column that is called "FY Final" (created in power query) which is also whole number format (e.g. 2023). I then tried to create another column (created in data modelling tab) called "In 25 year Plan?" which I need say "yes" or "no" if it falls within the next 25 FY years, however in "FY Final" column there are some nulls which is making it difficult to create this if statement. 

 

I'm trying to say, only do the following if statement if "FY Final" column is not null: "FY final" column - "current financial year" column is equal to or less than 25 then "yes" otherwise "no"

 

I cannot just filter out or remove these nulls unforunately as there are other columns within that same line that has data that I need to see.
  • Finally worked it out:

     

    = IF(NOT(ISBLANK([FY Final])),if([FY Final]-[Current Financial Year]<=25,"Yes","No"))

2 Replies

  • Current DAX formula I have tried which isn't working:

     

    IF(ISBLANK([FY Final]),BLANK(),if([FY Final]-[Current Financial Year]<=25),"Yes","No"))
    • siddrow's avatar
      siddrow
      Helper III

      Finally worked it out:

       

      = IF(NOT(ISBLANK([FY Final])),if([FY Final]-[Current Financial Year]<=25,"Yes","No"))