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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Fousek_Brousek
Regular Visitor

Using Date value as a way to restrict date range in plot visual

Hello, 

 

I would like to ask for help since I am quite stuck. The thing I need sounds pretty simple: I have a table visual which have two columns: Date column with dates and Price columns with prices. I would like to be able to click on any date in the table (i.e. row) and use this date to set x axis (dates) on plot visual on the same report page (for example the plot will show time range of 3 days before the selected date).  The reason for this is that I need to analyze other values/variables (liek weather etc) in the days around the given date to see the context and cause of this event (the reason of high price).  

 

Fousek_Brousek_0-1713358853083.png

 

The data model is prety simple: Price table has columns Date/Time/Country/Price and then there is Time table and Date table.

Fousek_Brousek_1-1713358943507.png


I though that I would be able to restrict the plot date range by selectedvalue function but it is just not working. Something like this: 

Average Price =

VAR SelectedDate = SELECTEDVALUE(Dates[Date])

RETURN

CALCULATE(
    AVERAGE(Prices[Price of electricity]),
    Prices[Date] <= SelectedDate - 3 && Prices[Date] <= SelectedDate
    )
Thank you for any help.
3 REPLIES 3
Fousek_Brousek
Regular Visitor

These are just the basic dummy data to understand how to do it and do some testing, but the problem I am dealing with is quite general and I need to be able to do it with any data. Thats why tried to describe it all in a general way. Thank you 

Fousek_Brousek
Regular Visitor

Here are the data (Excel file) 

 

https://cepscz-my.sharepoint.com/:x:/g/personal/vasil_ceps_cz/EQQmb7D_MfVNmG8RWAcbVHIBzkEboXmgqA2qKR...

 

Then there is also basic Date_table and Time_time in the model, created by the PowerQuery code in the .pbix itself. 


v-kongfanf-msft
Community Support
Community Support

Hi @Fousek_Brousek ,

 

Can you provide some test data about this model so that I can answer you as soon as possible.

 

Best Regards,
Adamk Kong

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.