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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Show two different sets of data in the same report using year filter

Hi,

 

I want to create two different sets of data on the same report using a year filter. Lets say for one of the data sets I want 2023 and the other data set I want 2024. I practically want to compare last year to the current year. 

 

What I did so far was create to seperate matrix tables and put a year filter on each of them, which worked perfectly fine. Although, it looks very messy and I wanted to create a measure that compared the current year to the past year so having them on the same matrix table would make it much easier. 

 

An example is something like this below:

                year 1      year 2      year 3     year 4

2023 xxx

2023 yyy

2024 xxx

2024 yyy

 

Is this possible, or do I have to create two seperate matrix tables?

 

Thanks

 

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You want create this year vs last year

 

with date table

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

with year or date table

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

 

Now if select a year and still want all year to display, make sure slicer is on independent table

 

 

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
selected Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=selectedvalue('Date1'[Year])))

 

and then take diff from selected value.

 

you need two independent tables in case you need two slicers

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you for your guidance, it's very much appreciated.

 

Am I able to filter multiple conditions (e.g. year is max (2024), it is "xxx" in category column)? I am planning on creating a year table that includes the fields required in the measure.

 

Here is an example: 

2024 =CALCULATE(SUM('Table'[Year 1 Forecast]),
ALL('Table'),'Table'[BudgetYear]=max('Table'[BudgetYear]),
'Table'[Category] in {"xxx"})
 
I think the code above is wrong as I just did it with little time before the end of the day, but is something like that possible? I would do something like that for both 2023 & 2024 then I would make a measure that does diff = [2023]-[2024].

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.