Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

TotalYTD Year_End_Date variable causes an error

I have measures that count year to date values for issues by status.

I use these measure as values for a stacked area graph.

 

These measure work when I hard code the Year_End_Date, e.g. "4-30"

 

_AMZLissuesAnswered = Calculate(TOTALYTD(DISTINCTCOUNTNOBLANK('issues_issues'[issue_id]),'issues_issues'[updated_at].[Date], "4-30"), 'issues_issues'[status] = "answered")

 

but I get the error A function 'Placeholder' has been used in a True/False expression...

when I replace it with a variable.

 

_CurrentDay = FORMAT(NOW(), "m-dd")

 

What am I missing in my variable _CurrentDay to work in the TotalYTD DAX function?

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    I solved this through a different approach.

    Instead of creating a measure for each status type with the TotalYTD function, I created a single measure for the status, and used status for the legend.

     

     

    _Status2022 = 
                 VAR MaxDate = MAX('issues_issues'[updated_at].[Date])
                 RETURN
                 CALCULATE(COUNT('issues_issues'[issue_id]),
                         DATESBETWEEN('issues_issues'[updated_at].[Date], "1-1-2022", MaxDate)
                 )

     

    In addition, the previous method with TotalYTD was also counting issues in previous years. The solution filters the count to a specific year now.

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    I solved this through a different approach.

    Instead of creating a measure for each status type with the TotalYTD function, I created a single measure for the status, and used status for the legend.

     

     

    _Status2022 = 
                 VAR MaxDate = MAX('issues_issues'[updated_at].[Date])
                 RETURN
                 CALCULATE(COUNT('issues_issues'[issue_id]),
                         DATESBETWEEN('issues_issues'[updated_at].[Date], "1-1-2022", MaxDate)
                 )

     

    In addition, the previous method with TotalYTD was also counting issues in previous years. The solution filters the count to a specific year now.