Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

DATESYTD / time intelligence not working in custom column

I apologize that I can't share the actual pbix file - I'll do my best to describe the problem.

 

I created a calendar table with a relationship to a CreatedOn .   Both are in a common 'Date' format - i.e. 1/1/2017.

 

However, time intelligence functions do not work at all.   I want to see the count of records with date YTD, and I have the following expressoin:

 

Custom Col = CALCULATE ( COUNTA(NameOfSomething), DATESYTD('Calendar'[Date]) )

 

Yet I am seeing ALL records.   I get the exact same results with no DATESYTD filter applied at all.

 

Any common reasons why this might occur?   I can provide more details if necessary.   Thanks again!

  • Hi Anonymous,

     

    DATESYTD() function is used for returning a table that contains a column of the dates for the year to date, in the current context. When you create a measure like below:

     

    =CALCULATE ( COUNTA(NameOfSomething), DATESYTD('Calendar'[Date]) )

     

    And place this measure in a table or matrix, it will return running count values for the year to date. In my sample, I write the measure like below:

     

    Measure = CALCULATE(COUNTA('SalesFact'[ProductID]),DATESYTD('Date'[Date]))

     

    1. The actual count of ProductID for each date is below.

     

     

    2. When we put the measure into the table, you can see the measure returns running count values until 12-31 then reset. (As we don't set end date of year in DATESYTD() function, the default is December 31)

     

     

    Best Regards,
    Qiuyun Yu

16 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I should note I have this data entered into a matrix table and I'm grouping it 'by person' associated with these records.

  • Are you creating a measure. 

     

    This formula works in the measure calculation. This measure then dragged and dropped in the table visualization to get your desired output.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Bhavesh - I tried first as a custom column, and it shows 'everthing' (does not filter).   When I try as a measure, I get no results (completely null/blank).

      • blopez11's avatar
        blopez11
        Icon for Super User rankSuper User

        Are you using a slicer with the Year column from your calandar (date) table?