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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sonuojha1
Helper IV
Helper IV

Monthwise Line graph with multiple measures for multiple selected year - dual axes

Hello All,

I have a requirement to show line graph for all selected year from year slicer as new line on the graph for all months on x-axis.

I have two measures called M1 and M2 and two y-axis as shown in below screenshots.

attached below images for your reference.

 

sonuojha1_5-1608133747455.png

 

sonuojha1_4-1608133456968.png

 

Regards,

Sonu

4 REPLIES 4
Anonymous
Not applicable

Hi @sonuojha1 ,

 

Line Chart is not supported for legend with multiple values. You will need to create measures for each line. Please show some sample data if you what us to help deal with DAX formula.

 

Best Regards,

Jay

Ashish_Mathur
Super User
Super User

Hi,

Could you share some data and show the expected result in a Table format?  Once the numbers in the Table appear correct, one can build any visual.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@sonuojha1 , you need to have 4 measures. as legends not supported with multiple meausres.

 

You can use time intelligence

example

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"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))


//Only year vs Year, not a level below

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
rolling = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]>=max('Date'[Year])-2 && 'Date'[Year]<=max('Date'[Year])) )

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

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

Thanks Amit for reply, 

But none of the formula is giving correct result. one of the measures formula is as below:

Result ( tried with your YTD formula- TimeSeriesEfficiency This Year)

sonuojha1_1-1608236229087.png

 

 

Actual calculation formula 

Effici =
VAR V_X=[Ther]*3412
VAR V_Y=[Total Wa]*100
var v_sum=IF(ISBLANK(V_X),0,V_X)+IF(ISBLANK(V_Y),0,V_Y)
VAR V_RES=IFERROR(V_SUM/[Total G]/1000,0)
RETURN
IF(ISBLANK(V_RES) || V_RES=0,BLANK(),V_RES)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Kudoed Authors