Forum Discussion

Axiomite's avatar
Axiomite
Icon for Resolver II rankResolver II
4 years ago
Solved

If in selected month

Hi,
Trying to use the slicer selected month rather the current month

This works:

 

But having an error on the following:

 

 

Can anyone help.
 
Kind regards,
Niel

 

  • Axiomite's avatar
    Axiomite
    4 years ago

    JorgePinho  - many thanks for your reply. I used a work around by created a column displaying current month and year. 


    Filter Date =
     VAR __max = MAXX(factTable,factTable[TxDate])
    VAR __year = YEAR(__max)
    VAR __day = DAY(__max)
    VAR __month = MONTH(__max)
    RETURN
    DATE(__year,__month-3,__day)

    I have then gone and used the other date and compared it with the Filter Date column in the above if statement and it solve my problem. 
    Kind Regards,
    Niel

2 Replies

  • MONTH doesn't allow a column has argument, so you have to use a summarize function. Try to correct it to MONTH(MAX([First ...])) 

    • Axiomite's avatar
      Axiomite
      Icon for Resolver II rankResolver II

      JorgePinho  - many thanks for your reply. I used a work around by created a column displaying current month and year. 


      Filter Date =
       VAR __max = MAXX(factTable,factTable[TxDate])
      VAR __year = YEAR(__max)
      VAR __day = DAY(__max)
      VAR __month = MONTH(__max)
      RETURN
      DATE(__year,__month-3,__day)

      I have then gone and used the other date and compared it with the Filter Date column in the above if statement and it solve my problem. 
      Kind Regards,
      Niel