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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors