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
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
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.