Skip to main content
cancel
Showing results for 
Search instead 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

Reply
avinashbeepath
Frequent Visitor

Sum year and previous year from that year selected from filtered list

Hello all,

 

I hope my title was not too misleading. I've researched my problem but still cant seem to find a robust solution to my problem. Can anyone please assist? 

 

year.jpgPax.jpg

 

My year table above as an example contains multiple years. But I would like to be able to select 2015 and get that year's passenger populated in the card vs the preious year which in this case would be 2014. How do I accomplish this? 

 

Thanks for any ideas contributed.

 

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@avinashbeepath

 

Max Year = CALCULATE( [Your Measure], FILTER (Table, Table[Year Column]=MAX(Table[Year Column]) ) )

Max Year -1 = CALCULATE ( [Your Measure], FILTER (Table, Table[Year Column]=MAX(Table[Year Column]) -1 ) )

 

YoY Change = [Max Year] - [Max Year -1]

YoY % Change = DIVIDE ( [YoY Change], [Max Year-1], 0 )

 

Let me know if this works!

View solution in original post

6 REPLIES 6
Sean
Community Champion
Community Champion

@avinashbeepath

 

Max Year = CALCULATE( [Your Measure], FILTER (Table, Table[Year Column]=MAX(Table[Year Column]) ) )

Max Year -1 = CALCULATE ( [Your Measure], FILTER (Table, Table[Year Column]=MAX(Table[Year Column]) -1 ) )

 

YoY Change = [Max Year] - [Max Year -1]

YoY % Change = DIVIDE ( [YoY Change], [Max Year-1], 0 )

 

Let me know if this works!

Hi Sean,

 

Thanks sooo much for your response!! It's a excellent start to a solution however I'm getting the below error response when i try to display the value.

 

Error.jpg 

Also this is the formula i used - 

MAX YEAR = CALCULATE('2015 vs 2016'[REVENUE MEASURE],FILTER('d_DATE_TBL','d_DATE_TBL'[Year]=max(d_DATE_TBL[Year])))

 

Can you identify where I went wrong? 

Edit - The name of the table is misleading 2015 vs 2016 as there is 2014 data in there as well. I was having major difficulty getting this part so I was only using 2016 vs 2015 data.

 

Thanks again so much for your willingness to assist.

What is the formula in the [Revenue Measure] ?

 

And what data type is the  [Year] Column?

 

I have the Year field in a datekey table and I just checked it out and it's set as a text field. Also the REVENUE MEASURE = sum('2015 vs 2016'[REVENUE]).

 

Thanks Sean.

 

Regards,

Avinash

Why is it text? Does it just contain the number? Like 2016?

Year.png

Ahhhh thank you So much Sean. I changed it to number and the formula worked immediately! It was imported as a text from excel. 

You are the man...thanks again for your time and assistance! 

 

Best Regards.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors