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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
BoSe2828
Frequent Visitor

Display Multiple YoY% Changes in a Line Chart Using a Field Parameter

Hi all,

 

My goal is to show multiple YoY%-Changes lines in a line chart based on a (multiple)selection of a field paramter.

I do have multiple measures that all show the sum of different columns. 
E.G.

 

Sales = SUM(Table['Sales'])
Orders = SUM(Table['Orders'])
...

 

I could create for each of these measure a new measure with the calculation like - but i want to avoid having to create like 20 of these measures:

 

Sales_YoY% = 
VAR __CV = [Sales]
VAR __PV = CALCULATE([Sales],SAMEPERIODLASTYEAR('Date'[Date]))
VAR __DIFF = __CV-__PV
RETURN
DIVIDE(__DIFF,__PV, BLANK())

 

 When i use calculation groups it does work with a table/matrix visual. However if i try to use it on a bar or line chart it only works if i select a single measure - which makes sense - i guess - as it uses SELECTEDMEASURE().

I tried to put the "parameter" on the Y-Axis and the "calculation item" on the legend.
Code for Calculation Group:

 

YoY% = 
VAR __CV = SELECTEDMEASURE()
VAR __PV = CALCULATE(SELECTEDMEASURE(),SAMEPERIODLASTYEAR('Date'[Date]))
VAR __DIFF = __CV-__PV
RETURN
DIVIDE(__DIFF,__PV, BLANK())

 

 Is there any way to manipulate multiple measures without creating a new measure for each of them?

 

Thanks.

 

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @BoSe2828 -  you can utilize calculation groups , to get the multiple Year-over-Year (YoY%) change lines in a single Power BI line chart based on the selection of multiple field parameters, without creating individual YoY measures for each one.

 

example: 

YoY% =
VAR __CV = SELECTEDMEASURE()
VAR __PV = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
VAR __DIFF = __CV - __PV
RETURN
DIVIDE(__DIFF, __PV, BLANK())

This calculation group will dynamically apply the YoY% calculation to any measure in the model that is used in the visual.

This solution may face limitations when visualizing multiple measures simultaneously because SELECTEDMEASURE() applies to a single measure. If you're selecting multiple measures and expect to see multiple lines in the same chart, you might need to adapt the setup to handle dynamic measure switching better.

you can use variables in the calculation group to conditionally calculate multiple measures in one visual and apply the YoY% calculation without separating them into individual measures.

 

Hope the above information helps in your scenerio





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 ,
as mentioned I'm already using a calculation group and it works fine with a table or matrix visual. My issues comes with displaying mutliple lines/columns in a line or column chart.

Anonymous
Not applicable

Hi, @BoSe2828 

 

I've tested and can't use calculation groups to display multiple lines in a line chart. Separate neasure are still needed, and each measure can correspond to a line.

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.