Forum Discussion
line charts
I have a data table as shown below.
I wish to create a multiple-line chart where I want to display codes A & B Sales on the primary axis and code C Sales on the secondary axis.
| date | code | Sales |
| 01-Jan | A | 50 |
| 01-Jan | B | 55 |
| 01-Jan | C | 60 |
| 15-Jan | A | 40 |
| 15-Jan | B | 75 |
| 15-Jan | C | 70 |
| 30-Jan | A | 40 |
| 30-Jan | B | 50 |
| 30-Jan | C | 60 |
| 01-Feb | A | 70 |
| 01-Feb | B | 60 |
| 01-Feb | C | 50 |
| 15-Feb | A | 45 |
| 15-Feb | B | 35 |
| 15-Feb | C | 20 |
| 28-Feb | A | 25 |
| 28-Feb | B | 50 |
| 28-Feb | C | 30 |
I am able to create the same in MS excel but seems facing issues in power BI.
2 Replies
- Uzi2019
Community Champion
Hi prashantg364
What issue you are facing in power bi ?? you didnt mentioned that.share screenshot what is you query?
for Y axis you can take value from other column it seems you all A B C values are coming under 1 column so that why power bi takes all you A B C values on Y axis not on secondary Y axis.
You can create a measure like this for Secondary Y axis
Column c= CALCULATE ( Sum( Sales), [Code]= "C")It will create a seperate measure for your C code. take your measure into secondary Y axis.
For Y axis create another measure with consist of 2 code A &B
Column A&B= CALCULATE ( Sum( Sales), AND([Code]= "A",[Code]= "B")Take column A&B in Y axis
Take column C in secondary Y axis.I hope I answered your question!
- Shivu-2000
Responsive Resident
Hey prashantg364
You can simply create two columns
1. For code - A&B
2. Foe code - C
and now you can simply create the multiple-line chart where you can display codes A & B Sales on the primary axis and code C Sales on the secondary axis.
To create the column use the following: https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-calculated-columnsI hope my answer was helpful to you!
Don't forget to give thumbs up and accept this as a solution if it helped you!!!