Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Issue using isonorafter () and a Date Var

Hello guys!.

Im trying to plot an accumulative sum based on the last date entered in a DateField Box. My plot has to show all the months of the current selected year (for example: if i pick 01-jun-20 on the second DateFieldBox ... the plot has to go from 01-jan-20 to 31-dec-20). 

I tried this code but it doesnt work as i expect.
01andres =

VAR month =
MONTH ( MAX ( 'Calendario'[Fecha] ) )
VAR year =
YEAR ( MAX ( 'Calendario'[Fecha] ) )
VAR last1 =
DATE ( year, 12, 31 )
VAR first1 =
DATE ( year, 1, 1 )
RETURN
CALCULATE(
    COUNTA('Tareas'[Tare_Fech_Prog]),
    FILTER(
        ALLSELECTED('Calendario'[Fecha]),
        ISONORAFTER('Calendario'[Fecha],last1, DESC,'Calendario'[Fecha],first1, ASC)
    )
)





 

When i use Max(), it works but it shows the values between the DateFilde box range entered and i dont want it.

 

What should i do?.

Thank youu!!

8 Replies

  • Anonymous , Try a measure like

     

    Cumm =
    var _max = maxx(allselected('Date'), 'Date'[Date])
    return
    CALCULATE(COUNTA('Tareas'[Tare_Fech_Prog]),filter(all('Date'),'Date'[Date] <=max('Date'[Date]) && year('Date'[Date]) = _max))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi amitchandak , thank you for your reply!

      I did it but it shows nothing. 


  • v-cazheng-msft's avatar
    v-cazheng-msft
    Community Support

    Hi, Anonymous 

     

    This is a video about the usage of the ISONORAFTER function. For your first formula, the usage of this function maybe a little bit wrong and only the first half of the parameters work. In addition, is there only data from 16-April-2020 to 31-December-2021 in your table?

     

    Best Regards,

    Caiyun Zheng

      • v-cazheng-msft's avatar
        v-cazheng-msft
        Community Support

        Hi, Anonymous 

        Is DateFieldBox in your report a Slicer? Can you provide a sample removing sensitive data and describe your report with more details?

         

        Best Regards

        Caiyun Zheng