Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi everyone,
I'm having some troubles with Power BI Desktop and I was wondering if someone could help me. Basically what I'm trying to do is to filter the X axis on a line chart and showing only the values for the last day (each day have data for their respective 24 hours and I need to show the data of each hour). The problem that I'm having right now is that I also need to add a data segmentation in case anyone need to watch the historical data. Does anyone knows if that's possible and how?
Hi @alfertab,
Thanks for the reply from AnushaSri.
I have another way to achieve your need, you could add a dateonly slicer since you want to add a data segmentation in case anyone need to watch the historical data.
Here are the detailed steps:
1). Add two columns separately for hour only and date only:
HourOnly = FORMAT('Table'[DateTime], "HH:00")
DateOnly = DATE(YEAR('Table'[DateTime]), MONTH('Table'[DateTime]), DAY('Table'[DateTime]))
2). Create a measure named LastAvailableDate to retrieves the maximum available date:
LastAvailableDate = MAX('Table'[DateTime])
3). Create a measure named SelectedOrLastDate to filter Data Based on Selection or Last Date:
SelectedOrLastDate =
VAR SelectedDate = MAX('Table'[DateOnly]) -- Ensure it picks only the date
VAR LastAvailableDate = CALCULATE(MAX('Table'[DateOnly]), ALL('Table'))
RETURN
IF(ISFILTERED('Table'[DateOnly]), SelectedDate, LastAvailableDate)
4). Create a measure named DataForLastOrSelectedDate to display last date if tehre is no selected date:
DataForLastOrSelectedDate =
VAR SelectedDate = [SelectedOrLastDate]
RETURN
CALCULATE(
SUM('Table'[Value]), -- Replace with your actual measure
'Table'[DateTime] >= SelectedDate && 'Table'[DateTime] < SelectedDate + 1
)
5). Configrue the visual as below:
Best Regards,
Qi
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Add a drill down to your chart, so that selecting a day data point would drill down to show you 24 hours data of that selected day data point.
Please mark this as solution accepted, if my answer help you resolve your issue.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
144 | |
72 | |
63 | |
52 | |
49 |
User | Count |
---|---|
208 | |
89 | |
62 | |
59 | |
57 |