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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

TotalYTD function as a graph for different years

Hello guys,

 

I want to build a measure to show the revenues per month for each year. I have done that, but they should be summarized each month.

 

I have two examples for that, how it should look like. So all I need is a TotalYTD function for the year 2018 and 2017 I guess.

 

 

Current visualization.pngHow it should look like.png

 

 

Thanks in advance!

 

Greetings,

Christopher

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @Anonymous

After my research, you could try this way:

Step1:

Add a year and month column for date column

Step2:

Use this formula to create a TotalYTD Measure

Measure = CALCULATE(SUM(Table1[Qty]),FILTER(ALL(Table1[Month]),Table1[Month]<=MAX(Table1[Month])))

Step3:

Drag month field into X-Axis and Year field into Legend

Result:

15.JPG

 

here is pbix file, please try it.

 

Best Regards,

Lin

 

 

 

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

View solution in original post

10 REPLIES 10
v-lili6-msft
Community Support
Community Support

hi, @Anonymous

After my research, you could try this way:

Step1:

Add a year and month column for date column

Step2:

Use this formula to create a TotalYTD Measure

Measure = CALCULATE(SUM(Table1[Qty]),FILTER(ALL(Table1[Month]),Table1[Month]<=MAX(Table1[Month])))

Step3:

Drag month field into X-Axis and Year field into Legend

Result:

15.JPG

 

here is pbix file, please try it.

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-lili6-msft

 

Is there an option to cut the graph in 2019 for the months in the future?

 

So when we have February 2019, the graph should only show the two months, actually it goes to linear line over the future months.Graph for 2019.png

 

 

Anonymous
Not applicable

Graph for 2019.png

Anonymous
Not applicable

That works perfectly, thank you very much!!

Try setting your months on the axis and your year in the legend.

 

Anonymous
Not applicable

Hi @jvangrunderbeec,

 

thanks for your fast reply, but when I will do that, I have the problem that I only see the year 2019 with the TotalYTD function. When I choose only the revenue as the graph instead of the TotalYTD function, I will have the same like in the first screenshot.

Try this formula:

 

Cumulative Revenue =
VAR CurrDate =
MAX ( DateTable[Date] ) //Insert datetable date column
Var CalculateddMeasure =
CALCULATE(sum(Revenue)) //Insert to calculate number
RETURN
//Total
IF (
ISBLANK ( CalculateddMeasure );
BLANK ();
IF (
COUNTROWS ( FactTable ) > 0; //Insert FactTable name
CALCULATE (
CalculateddMeasure;
FILTER (
ALLSELECTED ( DateTable ); //Insert Date Table name
DateTable[Date] <= CurrDate //Insert Date Table Date column
&& YEAR ( DateTable[Date] ) = YEAR ( CurrDate ) //Insert Date table Date column
)
);
BLANK ()
)
)
)

@Anonymous

 

 

Are you sure then that the number is correct? isn't is counting all your date? So it says 2019 but it is for all the yaers

Anonymous
Not applicable

The first one is how it is actually, the screenshot below is how it should be (revenues are summarized). And there  will compare the different years.

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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