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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TiborTuboly
Frequent Visitor

How to differentiate past data and future data on a line chart

Hi All,

I would like to create line charts with dates on the X-axis and values on the Y-axis.

I should differentiate the future data and past data (e.g. when the values belong to a future date, I should use dotted lines).

Do you have any kind of solution for this case?


Thank you.
Tibor

2 ACCEPTED SOLUTIONS

@TiborTuboly I guess you can achieve this by using couple of measures. Add following measures and put date on x-axis and these two measures on Y - Axis.

 

Amount = IF( MAX( Table1[Date] ) <= TODAY(), SUM( Table1[Amount] ) )

Amount Future = IF( MAX( Table1[Date] ) >= TODAY(), SUM( Table1[Amount] ) )

To show dotted line for future, go to format tab and under shapes, turn on customize series, and select "Amount Future" and change it to dashed.

 

image.png

 

 

This is how output will look like

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

walterfjr
Advocate I
Advocate I

Hi @TiborTuboly,
I created an example where basically in the modeling area I created a formula to check if the date is past or future:

 

DataType = IF (Exemple [Date] <TODAY (), "Past", "Future")

 

Later I put a line chart and put the DataType in Legend column, and in shapes> Customize series I formatted "Future" series as Dotted.

 

Example

 

Hope this helps

 

View solution in original post

3 REPLIES 3
walterfjr
Advocate I
Advocate I

Hi @TiborTuboly,
I created an example where basically in the modeling area I created a formula to check if the date is past or future:

 

DataType = IF (Exemple [Date] <TODAY (), "Past", "Future")

 

Later I put a line chart and put the DataType in Legend column, and in shapes> Customize series I formatted "Future" series as Dotted.

 

Example

 

Hope this helps

 

Greg_Deckler
Super User
Super User

I am not aware of a way to change the stroke type per line. You could have a different color potentially. Would need some sample data to put together an example. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@TiborTuboly I guess you can achieve this by using couple of measures. Add following measures and put date on x-axis and these two measures on Y - Axis.

 

Amount = IF( MAX( Table1[Date] ) <= TODAY(), SUM( Table1[Amount] ) )

Amount Future = IF( MAX( Table1[Date] ) >= TODAY(), SUM( Table1[Amount] ) )

To show dotted line for future, go to format tab and under shapes, turn on customize series, and select "Amount Future" and change it to dashed.

 

image.png

 

 

This is how output will look like

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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