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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

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 Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.