cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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()))))
Community Support

@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.

Community Support

@Anonymous ,

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

Regards,

Jimmy Tao

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors