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
erbver
Regular Visitor

Compare any two years' data, with years chosen in slicers

Hello! 

I am trying to build a table (perhaps eventually other visuals) that allows a user to select any year as the current year and any year as the comparison year, and see columns for the current year's and comparison year's "portfolio scores" side-by-side. Ideally I would also have a column that calculates the score difference (not shown):

erbver_0-1691777175159.png

 

erbver_4-1691776263862.png

Sample data:

Portfolio NameYearComponentAspectIndicatorIndicator NameScore MaxPortfolio Score
Portfolio 12021Component AAspect AInd1Indicator 154
Portfolio 12021Component AAspect BInd2Indicator 233
Portfolio 12021Component BAspect AInd3Indicator 365
Portfolio 12021Component BAspect BInd4Indicator 442
Portfolio 12022Component AAspect AInd1Indicator 154.5
Portfolio 12022Component AAspect BInd2Indicator 233
Portfolio 12022Component BAspect AInd3Indicator 365
Portfolio 12022Component BAspect BInd4Indicator 443
Portfolio 22021Component AAspect AInd1Indicator 153
Portfolio 22021Component AAspect BInd2Indicator 232
Portfolio 22021Component BAspect AInd3Indicator 364
Portfolio 22021Component BAspect BInd4Indicator 441
Portfolio 22022Component AAspect AInd1Indicator 153.5
Portfolio 22022Component AAspect BInd2Indicator 232.5
Portfolio 22022Component BAspect AInd3Indicator 364.5
Portfolio 22022Component BAspect BInd4Indicator 441.5

 

 

Aspect_Scores and Indicator_Scores contains data for both years, and more years will be added.

I tried following this video but I get the following error message.

erbver_0-1691775731976.png

 

If I add SUM or MIN like so:

 

Comparison Year Portfolio Score = CALCULATE(SUM(Indicator_Scores[Portfolio Score]),ALL('Current Year'),USERELATIONSHIP('Comparison Year'[Year],'Aspect_Scores'[Year]))

 

both the Portfolio Score and Comparison Year Portfolio Score columns change when I select the Comparison Year, but neither change when I select the Current Year.

 

I tried to experiment with using a calculated column row-by-row instead of a measure but wasn't able to get that to work either.

 

Thanks for your help!

2 REPLIES 2
Mahesh0016
Super User
Super User

@erbver  I hope this helps You! Thank You!!
Total Portfolio Score = SUM(Indicator_Scores[Portfolio Score])

Comparison Year Portfolio Score = 
CALCULATE(
                     [Total Portfolio Score]
                    ,ALL('Current Year')

                    ,USERELATIONSHIP('Comparison Year'[Year],'Aspect_Scores'[Year])
                  )

Hi @Mahesh0016, thank you for your help! Unfortunately it isn't working quite right. If I do your DAX as measures, Comparison Year Portfolio Score only shares rows with Total Portfolio Score if current year = comparison year. Otherwise, it duplicates all the rows (the first row is Indicator LE2):

erbver_5-1692029922816.pngerbver_6-1692029941703.png

 

If I do your DAX as calculated columns, the comparison year's values always equal the current year's values.

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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