Forum Discussion

bnisbet's avatar
bnisbet
Frequent Visitor
8 years ago
Solved

IF Statement &&&&

Trying to use an IF Statement to calculate if a date is in the current month.
When I take out "&&" it works fine, any ideas?

Audit In Current Month =
IF (
    YEAR ( 'Power BI List'[Visit 1 Date] ) = YEAR ( TODAY () )
        && MONTH ( 'Power BI List'[Visit 1 Date] ) = MONTH ( TODAY () ),
    "1",
    "0"
)

Thanks!
:)

  • Hi bnisbet,

     

    What error did you get?

     

    Based on my test, the formula you provided above should work.  :smileyhappy:

     

     

    Regards

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    By the way, why you don't use IF AND?

     

    Try this:

     

    Audit In Current Month =
    IF ( AND (
        YEAR ('Power BI List'[Visit 1 Date] ) = YEAR ( NOW() ),
              MONTH ('Power BI List'[Visit 1 Date] ) = MONTH ( NOW() ) ),
        "1",
        "0"
    )
  • v-ljerr-msft's avatar
    v-ljerr-msft
    Microsoft Employee

    Hi bnisbet,

     

    What error did you get?

     

    Based on my test, the formula you provided above should work.  :smileyhappy:

     

     

    Regards