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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Return Graph

Good morning,

I have a question, In my table I get a column with years in it (a year can occures plenty of times) and 10 measures which are associated to this column, (M1,....M10).

I would like to have a graph with my 10 measure in my x axis and the value of my measure by year as my values. I join a draw to show you what I expect.

PatVi_0-1624267232149.png

But when I try to do it it gives me this and I don't achieve to modify it:

PatVi_1-1624267444287.png

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

If you are using measures on your values you are not abble to get the result you need simply with the use of this measures and the year column.

 

Create a new table with all your measure names and and ID column something similar to:

ID MeasureName
1 Measure1
2 Measure2
... ...
10 Measure10

 

Now create the following measure:

Selection =
SWITCH (
    SELECTEDVALUE ( Table[MeasureName] ),
    1, [Measure1],
    2, [Measure2],
    ..., ...
    10, [Measure10]
)

 

Now make your line chart with the following setup:

  • Axis: MeasureName (Column)
  • Legend: Year (Column)
  • Values: Selection (Measure)

Should return expected values


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @Anonymous ,

 

If you are using measures on your values you are not abble to get the result you need simply with the use of this measures and the year column.

 

Create a new table with all your measure names and and ID column something similar to:

ID MeasureName
1 Measure1
2 Measure2
... ...
10 Measure10

 

Now create the following measure:

Selection =
SWITCH (
    SELECTEDVALUE ( Table[MeasureName] ),
    1, [Measure1],
    2, [Measure2],
    ..., ...
    10, [Measure10]
)

 

Now make your line chart with the following setup:

  • Axis: MeasureName (Column)
  • Legend: Year (Column)
  • Values: Selection (Measure)

Should return expected values


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Anonymous
Not applicable

@MFelix Thank you, I tried it but I can't put Year in the legend because is not in the same table so they ask me to manage the relashionship between the two tables. And I can't do it because it's doesn't exist any.

Have you have some idea?

Thank you

Can you share a sample of your data model, and how the measures are calculated?

 

 

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Anonymous
Not applicable

@MFelix Yes sure, Thank you
my measures are like this
M1 = COUNTX(FILTER('Table',Table[Date2]=EDATE(Table[Date1],1)), Table[Date2])
M2 is the same except I have EDATE(Table[Date1],2)
M3 with EDATE(Table[Date1],3)....
With my following excel:
Thank you
Have a nice day
 

Hi @Anonymous ,

 

Has you can see I was abble to get results has expected:

 

MFelix_0-1624277313868.png

Check PBIX file attach.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Anonymous
Not applicable

Thank you!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.