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
ostur
Frequent Visitor

YTD Calculations (with a twist)

I'm trying to create a YTD calculation, but because my data is set up in a weird way (I know, I'm working on it) I am having a hard time creating a YTD calculation in PowerBI.

 

Here below is a screenshot of how it is set up:

ostur_0-1669742396572.png

 

And I am trying to set up a view like this:

ostur_1-1669742416077.png

Where I compare performances over time. Simple so far.

 

But what I'm trying to show is both a view where I can show the performance data for only in Month nr.2 but also show YTD performance comparisons (Months 1+2), ideally for all years.

 

Whats the easiest way to do that?

 

Thank you for your help!

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @ostur ,

1. First make a duplicate of the table in Power Query, Then complete all the years and months for each record.

vcgaomsft_0-1669802266984.png

2. Make another copy of the table and unpivot the three columns.

vcgaomsft_1-1669802476899.png

3. Merge query and expand value:

vcgaomsft_2-1669802595337.png

Table2:

vcgaomsft_3-1669802638940.png

4. In desktop, Please new a measure like:

YTD = CALCULATE(SUM('Table2'[Value]),'Table2'[Month]<=MAX('Table2'[Month]))

result:

vcgaomsft_4-1669803118994.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Hi Gao,

 

Thank you very much for the feedback and assistance.

 

In general I agree that this data structure makes more sense, and I'm working towards that, but right now I'm locked into this specific data structure (i.e. different columns for different values).

 

Working in that framework, is there a solution?

 

Thank you,

Tryggvi

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.