Forum Discussion
Display Multiple YoY% Changes in a Line Chart Using a Field Parameter
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
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.
- Anonymous1 year agoNot 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.