Forum Discussion

Jmccoy's avatar
Jmccoy
Helper II
6 years ago
Solved

Adding a date range filter into a DAX measure

I have a DAX measure that is working how I want except for the date range. It needs to be different than the visual I am putting it into.  

 

Booked Count = CALCULATE(COUNT(Dashboard_Sales[ProjName]),Dashboard_Sales[Project Status] = "PJ") + CALCULATE(COUNT(Dashboard_Sales[ProjName]),Dashboard_Sales[Project Status] = "FT")
 
I need to add within the above formula to only pull projects that has this status with a PJ date in the current year. Currently it is pulling all projects done over the years. 
  • Jmccoy you can use DATESYTD function

     

     

    Booked Count =
     CALCULATE(
    COUNT(Dashboard_Sales[ProjName]),
    Dashboard_Sales[Project Status] IN {"FT", "PJ" },
    DATESYTD( DateTable[Date] )
    )

     

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

2 Replies

  • Jmccoy you can use DATESYTD function

     

     

    Booked Count =
     CALCULATE(
    COUNT(Dashboard_Sales[ProjName]),
    Dashboard_Sales[Project Status] IN {"FT", "PJ" },
    DATESYTD( DateTable[Date] )
    )

     

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

  • Hi, Please try the below dax Booked Count = CALCULATE(COUNT(Dashboard_Sales[ProjName]),Dashboard_Sales[Project Status] = "PJ", DATESYTD(Datestable[Date])) please add the datesytd with your date column.