Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 3
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

v-lionel-msft_0-1601371365772.png

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.

Greg_Deckler
Super User
Super User

@Anonymous Time "intelligence" starts to get wonky if you stray outside the lines. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@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")),
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.