Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

TotalYTD Advanced calculation

Hi, I have to calculate TotaYTD but the companies had different fiscal years, so I have to change the TotalYTD parameter for each one of them, for example:

 

Country   -   Company -  Store -  Sales

USA         -   Company1 -  ST1 -    1000    (the fiscal year ends on 31/12)

USA         -   Company2 -  ST2 -    500    (the fiscal year ends on 31/1)

Canada     -   Company4 -  ST5 -    10    (the fiscal year ends on 31/12)

.....

 

The measure I was using was the traditional Sales YTD = TOTALYTD([SALES],date[day],'31/01') but this doesnt take into account the different fiscal years.

I have an auxiliary table with the fiscal years for each company, so the problem is, how can I calculate the YTD at the company level to be able to change the fiscal year depending the company?

 

thanks a lot.

 

3 Replies

  • Anonymous , totalytd, and datesytd do not allow a dynamic value for year-end this means you have to create a measure like. But this will company in the context

     

    Switch( true() ,
    max([Company]) = "Company1" ,CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31")),
    max([Company]) = "Company2" ,CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"1/31")),
    max([Company]) = "Company3" ,CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31")),
    )

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

    Hi Anonymous ,

     

    If you have a table like this, you can add the [Company] column to the slicer and filter through the slicer.

    In doing so, you only need to create a measure, not for each company.

     

    Best regards,
    Lionel Chen

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