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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
dankello
Frequent Visitor

How to create a line chart from multiple excel sheets

Hi,

 

For student rewards (Bronze, Silver, Gold). I need to create a line chart which tracks progress over several weeks. Each week data is on a separate excel sheet. I want the line chart to look like this:

 

chart1.png

The data is on sheets like this:

week1.PNGweek2.PNGweek3.PNG

 

How can I create this line chart in Power BI?

 

Thank you in advance 🙂

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dankello 

You can import the three tables to power bi, then create a calculated table

 

Table = var a=SUMMARIZE(ADDCOLUMNS('Week 1',"Week","Week1"),[Pupil],[Reward],[Week])
var b=SUMMARIZE(ADDCOLUMNS('Week 2',"Week","Week2"),[Pupil],[Reward],[Week])
var c=SUMMARIZE(ADDCOLUMNS('Week 3',"Week","Week3"),[Pupil],[Reward],[Week])
var d=GENERATEALL(GENERATEALL(SUMMARIZE('Week 1',[Pupil]),SUMMARIZE('Week 1',[Reward])),{"Week0"})
return ADDCOLUMNS(UNION(a,b,c,d),"Score",IF([Week]<>"Week0",SWITCH([Reward],"Gold",3,"Sliver",2,1),0))

 

Then create a measure

 

Measure = MAX('Table'[Score])

 

Then put the following field of the table to the line visual

vxinruzhumsft_0-1697097226607.png

 

Output

vxinruzhumsft_1-1697097242762.png

Best Regards!

Yolo Zhu

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

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @dankello 

You can import the three tables to power bi, then create a calculated table

 

Table = var a=SUMMARIZE(ADDCOLUMNS('Week 1',"Week","Week1"),[Pupil],[Reward],[Week])
var b=SUMMARIZE(ADDCOLUMNS('Week 2',"Week","Week2"),[Pupil],[Reward],[Week])
var c=SUMMARIZE(ADDCOLUMNS('Week 3',"Week","Week3"),[Pupil],[Reward],[Week])
var d=GENERATEALL(GENERATEALL(SUMMARIZE('Week 1',[Pupil]),SUMMARIZE('Week 1',[Reward])),{"Week0"})
return ADDCOLUMNS(UNION(a,b,c,d),"Score",IF([Week]<>"Week0",SWITCH([Reward],"Gold",3,"Sliver",2,1),0))

 

Then create a measure

 

Measure = MAX('Table'[Score])

 

Then put the following field of the table to the line visual

vxinruzhumsft_0-1697097226607.png

 

Output

vxinruzhumsft_1-1697097242762.png

Best Regards!

Yolo Zhu

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

 

This solution provides exactly what the OP is asking for but perpetuates bad design and increases maintenance of the solution over time (you need to add a new sheet, new calculation, and modify the calculated table every turn of a week!!!!!!). If this is a one off throw away project or just a fictitiuos inquery to give you what you need for a real situation you have no power over, then use it. Otherwise invest an hour into chaning the source data design as show in my previous reply. You will be glad you did.

Data-estDog
Resolver II
Resolver II

Add a WeekNumber Column to sheet 1. Or better yet, a DATE

So columns look like....
Date, Pupil, Form, Reward

Combine all the data to a single sheet, adding the Date to each entry. 

Import to power bi. 

If I answered your question, please mark my post as solution, Appreciate your Kudo

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.