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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

YTD sales show all for last year

Hello,

 

I am trying to make a comparison of sales using the YTD function in PowerBi desktop. I have both the DAX-formulas working for the current year and last year I am however stumbling upon a problem. The table I use to show the data only shows the sales of last year up to the current date. I want it to show all data for the remaining months(july - december). Is there anyway to do this?

5 REPLIES 5
Anonymous
Not applicable

It sounds like your function is calculating based on TODAY() showing all totals up to todays date. If you want to include remaining months you will need to change TODAY() to 12/31/2019.

 

If you post your DAX it might be easier to explain. 

Anonymous
Not applicable

Thank you @Anonymous  for your reply. For the current year sals this is the formula;

Sales (current year) = CALCULATE([Total Sales];DATESBETWEEN(Datetable[Date];DATE(YEAR(TODAY());1;1);TODAY()))
 
For the last year:
Sales (last year) = CALCULATE([Total sales];DATESBETWEEN(Datetable[Date];DATE(YEAR(today())-1;1;1);DATE(YEAR(today())-1;MONTH(TODAY());DAY(TODAY()))))

@Anonymous ,

 

You just need to create an additional measure using DAX as below:

Remaining =
CALCULATE (
    [Total Sales];
    DATESBETWEEN ( Datetable[Date]; TODAY (); DATE ( YEAR ( TODAY ); 12; 31 ) )
)

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

Hello @v-yuta-msft ,

 

Thanks for your reply. However I get an error on the first TODAY (); in the formula. 

@Anonymous ,

 

What does the error message say? Could you please share more details?

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors