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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Dn_wemn
Helper II
Helper II

Total of Sales value from Start of year until actual day per Year

Hi, 

sorry if this is reposted, my last post was somehow marked as spam.

I'd like to display the total values of Sales for each year from start of year until actual day (today), assuming actual day is 12th February.

In this example, for 2023 only sum up the values until 01.02.2023 (latest date) -> Total is 1249 (233 + 563 + 453)

For 2024 -> Total is 1661 (768 + 547 + 346)

Dn_wemn_0-1707772886555.png

 

If required, I've already created a Date table and a relationship between Date and Sales table.

 

DATESYTD and TOTALYTD have not worked for what I want.

Thank you for your help.

1 ACCEPTED SOLUTION
Dn_wemn
Helper II
Helper II

Hi thanks for your suggestions. 

I have solved this with:

Sales YTD til today =
var _max = format(today(),"MMDD")
return
calculate(Sum(TableData[Sales]),DATESYTD('Date'[Date]),format('Date'[Date],"MMDD")<=_max)

View solution in original post

3 REPLIES 3
Dn_wemn
Helper II
Helper II

Hi thanks for your suggestions. 

I have solved this with:

Sales YTD til today =
var _max = format(today(),"MMDD")
return
calculate(Sum(TableData[Sales]),DATESYTD('Date'[Date]),format('Date'[Date],"MMDD")<=_max)
Ashish_Mathur
Super User
Super User

Hi,

Create a slicer and drag Year from the Calendar Table.  Select 2024 in the slicer.  Try this

Sales = calculate(sum(Data[Sale]),datesbetween(calendar[date],min(calendar[date]),today()))

Sale LY = calculate([sales],sameperiodlastyear(calendar[date]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

You usually take your current year's filter and then apply SAMEPERIODLASTYEAR to it.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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