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
supasith
Frequent Visitor

Animated line chart show only one value

Dear friend

I tried to use the "Play Axis" visual , it should display progressive with historical data but it only displays one value at a time.

how can I fix it?

what I need 

ezgif-4-e8d476af99b1.gif

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @supasith ,

 

Create a disconnected table with the values of your play axis and then add the following measure to your line chart and use the new table to the Axis:

TotalSales =
IF (
    SELECTEDVALUE ( 'YearPlayAxisTable'[Year] ) >= MAX ( 'Table'[Year] ),
    SUM ( 'Table'[Value] ),
    IF (
        COUNTROWS ( ALL ( 'YearPlayAxisTable'[Year] ) )
            <= COUNTROWS ( ALLSELECTED ( 'YearPlayAxisTable'[Year] ) ),
        SUM ( 'Table'[Value] )
    )
)

 

If you want to keep the chart with all the year shown enter a measure like this:

FlatLine = 0

 

For this line set the line size has 0 and the data labels off

 

Result below and in attach PBIX file:

 

line_char_active.gif

If you want you can change the flat line by another value to get it more dinamic and don't set the y-axis maximum and minimum.

 

 


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

12 REPLIES 12
Anonymous
Not applicable

This works! 

Thank you so so much!

MFelix
Super User
Super User

Hi @supasith ,

 

Create a disconnected table with the values of your play axis and then add the following measure to your line chart and use the new table to the Axis:

TotalSales =
IF (
    SELECTEDVALUE ( 'YearPlayAxisTable'[Year] ) >= MAX ( 'Table'[Year] ),
    SUM ( 'Table'[Value] ),
    IF (
        COUNTROWS ( ALL ( 'YearPlayAxisTable'[Year] ) )
            <= COUNTROWS ( ALLSELECTED ( 'YearPlayAxisTable'[Year] ) ),
        SUM ( 'Table'[Value] )
    )
)

 

If you want to keep the chart with all the year shown enter a measure like this:

FlatLine = 0

 

For this line set the line size has 0 and the data labels off

 

Result below and in attach PBIX file:

 

line_char_active.gif

If you want you can change the flat line by another value to get it more dinamic and don't set the y-axis maximum and minimum.

 

 


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



I made the same formula, but when I give play I don't join the lines

Hi, 

 

Can you send a sample file please. 


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



Hi @Crosales ,

 

Check the 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



Thank you and if you wanted with months and years
Example

2020-January, 2020-February, 2020-March, ...... 2021-January, 2021-February...... 2023-January

Ano_Mês = format(EJEMPLO[Fecha], "YYYY-MMM")

Sort = FORMAT(EJEMPLO[Fecha], "YYYYMM") 

Use the following syntax to create the YearPlayaxis table

YearPlayAxisTable = FILTER(SUMMARIZE(EJEMPLO, EJEMPLO[Año], EJEMPLO[Mes], "Date", MAX(EJEMPLO[Fecha])), EJEMPLO[Año] <> BLANK())

 

Change you calculation to:

TotalSales = 
IF (
    SELECTEDVALUE ( YearPlayAxisTable[Date] ) >= MAX ( EJEMPLO[Fecha] ),
    SUM ( EJEMPLO[Ctd.en UM entrada] ),
    IF (
        COUNTROWS ( ALL ( YearPlayAxisTable[Date] ) )
            <= COUNTROWS ( ALLSELECTED ( 'YearPlayAxisTable'[Date] ) ),
        SUM ( EJEMPLO[Ctd.en UM entrada] )
    )
)

Result below:

playaxis.gif

Hi @Crosales ,

 

Add two columns to your model Year-Month and Sort

 


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



Thanks a lot!

Anonymous
Not applicable

Dear MFelix, 

I wonder if I can also do this for my historical data? The difference with my power bi report is that I use category x axis as "categorical data" instead of year. So I use a category of "100 days", "200 days", 300 days", so on. I followed the DAX above - but it seems it did not work because my data is in "categorical" instead of "continuous data". Could you help me with this? 

I attached the power bi file here.  power bi file 

 

Thank you so much. Screenshot 2021-08-18 09.17.10.png

 

Hi @Anonymous ,

 

Has I refered you need to have a disconnected table so in your case just do the following steps:

  • Delete the relationship between Try out and Date Category
  • Create the following measure:
RunningTotalAxis = 
IF (
    SELECTEDVALUE ( 'Date category'[Category of date] ) >= MAX ( 'Try out'[Category of date] ),
    [Running Total],
    IF (
        COUNTROWS ( ALL ( 'Date category'[Category of date] ) )
            <= COUNTROWS ( ALLSELECTED ( 'Date category'[Category of date]) ),
       [Running Total]
    )
)
  • Format you line chart in the following way:
    • Axis: 'Try Out'[Category of Date]
      • Turn On: Show Items without Data
    • Values: [RunningTotalAxis]
  • If you want set the maximum Y-Axis value (I did it to 150 but you can use a measure)
  • Play axis visual:
    • 'Date category'[Category of date]

On the image below the bottom chart is the one only using the Try out table for comparision and without interactions with the play axis.

 

play_axis.gif

 


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

Dear @MFelix , 

I have another question. So in my file, I have 4 line graphs in one spreadsheet. What I did in power BI for each graph is to filter it per category. But I realised that in the first line graph - the x-axis is missing "500 days" category. This may be because there is no data in that category. Is it possible to still show that category? I would like to show the x axis category as the ones in Digital events (100, 200, 300, 400, 500 and 600). 

 

Thank you and I appreciate your help. 

Best,

Sherly

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 Solution Authors
Top Kudoed Authors