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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
andreazambon
Helper V
Helper V

TOTALYTD with this year as end year

Hi there. 

 

I've built a measure that calculate the YTD of another measure. 

I'm using the Datetable as reference and seems to work.

 

 

YTD_%DescScrap_TOTScrapkg = TOTALYTD([%DescScrap_TOTScrap_kg], DateTable[date], YEAR((DateTable[date])))

 

and I didn't use any filter.

My problem is that I don't know how to check if the end_year (which I need to set as this year), calculate as in formula, is this year.

The Datetable which I use is a standard Datetable where "date" is a field formatted as "gg/mm/yyyy", but it contains dates from 2025 so I can't use the MAX() function.

I tried using YEAR(Today()) but with ont success. 

 

Any suggestion? Please let m,e know if you need some more details or info.

Thanks.

1 ACCEPTED SOLUTION

I get the answer by myself.

 

Suppose to have a filter in all the pages of my report where I set year >=2021. 

As I suspected, that measure gives me the YTD value from 01/01/2021 to today. 

 

I need a measure that gives me the YTD value starting from 01/01/actualyear to today. 

View solution in original post

6 REPLIES 6
andreazambon
Helper V
Helper V

If I put a column like that, probably i'll have a column with more than this year (2023;2024;2025). I thought about it but maybe I didn't think enought :P.

U give me a good idea to check the result, thankyou.

3CloudThomas
Super User
Super User

You should have a column in your date table that has the year. If you place this next to the YTD measure ina table, it will show you the year.

3CloudThomas_0-1706534365805.png

 

ok I tried but i don't understand why if I put the year field in the table it works:

 

andreazambon_0-1706536948687.png

and if I don't put it the value is empty:

 

andreazambon_1-1706536978673.png

 

There is no context for the measure to display a value. The function is Year to date total, so unless you tell what year or what Year plus Quarter or Year plus Quarter plus Month, there is no way for it to calculate a Year to Date value.

it should, because i'd like to put the end_year (in this case, 2024 but i need something to say it dynamically every year) directly in the DAX formula. 

It seems that the measure actually just calculate the total YTD from all the years I have in my filters and not just for the actual year.

 

My goal is to calculate the YTD 2024 also if my PBI visual filters says that Year>= 2022 

 

 

Take this as example: no filters on the years, i don't undertand if my formula starts from 01/01/2021 or at the 1st january for each year. So, the 2023 value of 5.1% is calculated between 0101/2021-31/12/2023 or 01/01/2023-31/12/2023?

 

andreazambon_0-1706538284004.png

 

I get the answer by myself.

 

Suppose to have a filter in all the pages of my report where I set year >=2021. 

As I suspected, that measure gives me the YTD value from 01/01/2021 to today. 

 

I need a measure that gives me the YTD value starting from 01/01/actualyear to today. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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