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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
tspoon
Frequent Visitor

Line chart, keeping one of the x-axis for reference of the other x-axis value

Dear all,

Another help needed for Line Chart.

 

How to keep one the x-axis which showing 15 weeks Plan value (0-100%) while the other x-axis showing value of the the selected week from the slicer?

 

Here’s the goal expected:

This page showing values of the first to fifth week if we select 5th week from the slicer:

tspoon_2-1721276051266.png

(right image: hovering to the last Actual value)

 

This page showing values of the first to sixth week if we select 6th week from the slicer:

tspoon_3-1721276093489.png

(right image: hovering to the last Actual value)

 

Many thank's in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tspoon 

 

My solution is as follows, you can try it out.

 

  1. Here are the columns included in my example table. The “plan” and “actual” here represent the percentage.  1.png
  2. Create a new table using the following DAX : Table2 = SELECTCOLUMNS('Table',"week",'Table'[week], "weeknum", 'Table'[weeknum])  2.png
  3. Create a measure for actual progress using the following DAX: ActualMeasure = CALCULATE(SUM('Table'[actual]), FILTER('Table', 'Table'[weeknum] <= MAX('Table2'[weeknum])))  
  4. Create a line chart, put the “week” of the “Table” table into the X-axis, and the “plan” of the “Table” table and the new metrics created in the previous step into the Y-axis. Create a slicer, put the “week” of the “Table” table into the X-axis, and the “plan” of the “Table” table into the Y-axis. Table2” into Field.  4-1.png4-2.png
  5. Select the measure used in the Y-axis and format it to percentage under the Measure tools tab.  5.png
  6. Here is my final test result.   6.png

    I hope this solution meets your requirements.

     

     

    Best Regards,

    Jarvis Tang

    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 @tspoon 

 

My solution is as follows, you can try it out.

 

  1. Here are the columns included in my example table. The “plan” and “actual” here represent the percentage.  1.png
  2. Create a new table using the following DAX : Table2 = SELECTCOLUMNS('Table',"week",'Table'[week], "weeknum", 'Table'[weeknum])  2.png
  3. Create a measure for actual progress using the following DAX: ActualMeasure = CALCULATE(SUM('Table'[actual]), FILTER('Table', 'Table'[weeknum] <= MAX('Table2'[weeknum])))  
  4. Create a line chart, put the “week” of the “Table” table into the X-axis, and the “plan” of the “Table” table and the new metrics created in the previous step into the Y-axis. Create a slicer, put the “week” of the “Table” table into the X-axis, and the “plan” of the “Table” table into the Y-axis. Table2” into Field.  4-1.png4-2.png
  5. Select the measure used in the Y-axis and format it to percentage under the Measure tools tab.  5.png
  6. Here is my final test result.   6.png

    I hope this solution meets your requirements.

     

     

    Best Regards,

    Jarvis Tang

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

     

Hi @Anonymous ,

 

Thanks for solution, it's really help me to understand the concept.

But still there is one problem. After I add W10 as new data, the line chart (x-axis) is not sorting well, even after I set "weeknum" for  "sort by column" in the "table view". 

tspoon_0-1721616621307.png

 

 

tspoon
Frequent Visitor

Found it!

Select "three dots (more options)" from the visual, select "sort axis" then select the "plan" and also select "ascending".

 

Thanks

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors