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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Line chart challenge

(Edited)
Hi,

 

I intend to create a single line chart that visualizes 2 set of values - OValue and Forecast_Value. (both in different tables)

 

The user is given an option to choose a Product ID using a slicer. Also the user chooses the Run ID from the given filter which provides PBI the anchor date > i.e. the visual will show data N days before and N after the anchor date. 

 

Using the anchor date (suppose T) to the product ID, I intend to display:

1. OValue for 3 days prior to the date T (i.e T-3 days) and

2. Forecast_Value for 10 days after the date T (i.e T+3 days)

 

Both should be on the same graph visual as follows (here I have chosen 3rd january as the anchor date - Blue line is for OValues and Orange line for Forecast_Value

 

ksr_0-1627465186693.png

 

( I tried uploading the PBIX but the portal is not supporting it) The images of the mock data are as follows
Ovalue Table

ksr_0-1627465518979.png

Forecast Value table

ksr_1-1627465572321.png

 

 

4 REPLIES 4
Anonymous
Not applicable

Thanks for the prompt response members . But the model is this:

ksr_0-1626950621281.png

Suppose Value A is Sales which is in one table and Value B is Forecasted sales in the other table.
The visual looks like this - assuming I have forecasted values for all dates.

ksr_1-1626950730708.png

Here based on the date as the slicer, I intend to visualise Sales for T-10 days and Forecasted sales for T+10 days.

Its yet to be solved.

Hi  @Anonymous ,

 

Could you pls provide a sample .pbix file for test?

 

Best Regards,
Kelly

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

v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

First create a date table as slicer;

Then create a measure a below:

Measure = 
var _date=SELECTEDVALUE('Date table'[Date])
Return
IF(MAX('Table'[Date])>=_date&&MAX('Table'[Date])<=_date+10,SUM('Table'[Value B]),IF(MAX('Table'[Date])<_date&&MAX('Table'[Date])>=_date-10,SUM('Table'[Value A])))

And you will see:

vkellymsft_2-1626940471042.png

 

vkellymsft_1-1626940443233.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

amitchandak
Super User
Super User

@Anonymous , with help from a date table and date from date table is used on axis

 

Value_A = calculate(sum(Table[Value]), dateadd('Date'[Date],-10,day))

 

Value_B = calculate(sum(Table[Value]), dateadd('Date'[Date],10,day))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.