Forum Discussion

ArchStanton's avatar
ArchStanton
Icon for Power Participant rankPower Participant
3 years ago
Solved

Cannot get YTD calculation to Sum

Hi,

 

I'm trying to SUM the values in the column called Count which is stored in a table called Deferrals. There is a column called Case StartDate within the Deferrals table but when I use that the Code fails completely, so I'm using the Createdon date column in another table that is related to the Deferrals table.

 

Sum of Deferrals = 
                        TOTALYTD(SUM(Deferrals[Count]),
                        'Cases'[createdon],
                        "31/03")

 

How can I SUM the values in Deferrals[Count)? 

 

FYI Count = 58

      SUM   = 60

 

I can only get 58 no matter what I try

 

Thanks,

  • Hi, ArchStanton 

     

    Can you provide sample data for testing? Sensitive information can be removed in advance. You can also show it with pictures. I look forward to your response.

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • ArchStanton's avatar
    ArchStanton
    Icon for Power Participant rankPower Participant

    Hi,

    I realised that the Cases[createdon] date column did not contain a continous series of dates and there was no  relatationship with my Date2 calendar table. After some trial and error the following code has worked for me:

     

    Cases Deferred2 YTD = CALCULATE(
                            TOTALYTD(SUM(Deferrals[Count]),
                            'Cases'[createdon],
                            USERELATIONSHIP(Date2[Date],'Cases'[createdon]),
                            "31/03"))
                            

     

    This gives me the correct answer of 60.

     

    Thanks for replying anyhow!

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, ArchStanton 

     

    Can you provide sample data for testing? Sensitive information can be removed in advance. You can also show it with pictures. I look forward to your response.

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.