March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All,
I'm new to Power BI and I am having difficulties. I have some slicers as filters and two chart as below:
The bottom chart shows data with data according to date selected in the slicers which is straight forward. E.g. The slicer selected 15-Oct-2017, the bottom chart should shows 15-Oct-2017 as well.
The upper chart should shows the next 2 days of the selected chart, i.e. data of 16&17-Oct-2017 should be shown. How do I achieve this in a dynamic way so that when slicer selection change, this chart changes accordingly?
Thanks in advance
Solved! Go to Solution.
Hi @ImNewUser,
I test using your sample data and get expected result. Please follow the steps below.
1. Create a Calendar table. Create Calculated columns the Year, Month, Day, and the next to days using the formula below.
Year = YEAR('Calendar'[Date]) Month = MONTH('Calendar'[Date]) Day = DAY('Calendar'[Date]) next 2 days = 'Calendar'[Date]+2
2. Create three slicers including Calendar[Year], Calendar[Month], Calendar[Day] separately.
3. Create two measures to get the filtered data and corresponding next two day.
Selected value = SELECTEDVALUE('Calendar'[Date]) next 2 days selected = SELECTEDVALUE('Calendar'[next 2 days])
4. Create a slicer including Table[Area], create two measure to get count value the next two days and selected date as follows.
next 2 days value11 = CALCULATE ( SUM ( Table1[Count] ), FILTER ( Table1, AND ( DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) > [Selected value], DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) <= [next 2 days selected] ) ) ) filtered date = CALCULATE ( SUM ( Table1[Count] ), FILTER ( Table1, DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) = [Selected value] ) )
Please review the expected result as the screenshot shown.
You can download the .pbix file from attachment for more details.
Best Regards,
Angelia
Hi @ImNewUser,
What your data source look like? You have one or two tables? You'd better share your sample table, you can create a fake one if your data is private, so that we can help you in dedicatedly.
Thanks,
Angelia
Hi Angelia,
Thanks for helping. This is my first time to post a thread and i'm not sure how to attach file to here... Anyway, the data is fake and is simple, I'm pasting as below:
Record Number | Starting Date | Area | Count |
1 | 15/10/2017 13:00:00 | A | 12 |
2 | 15/10/2017 14:00:00 | A | 13 |
3 | 15/10/2017 15:00:00 | A | 14 |
4 | 15/10/2017 16:00:00 | A | 15 |
5 | 15/10/2017 20:00:00 | A | 16 |
6 | 15/10/2017 07:00:00 | A | 17 |
7 | 16/10/2017 09:00:00 | A | 18 |
8 | 16/10/2017 12:00:00 | A | 19 |
9 | 16/10/2017 18:00:00 | A | 20 |
10 | 16/10/2017 22:00:00 | A | 21 |
11 | 17/10/2017 10:00:00 | A | 22 |
12 | 17/10/2017 16:00:00 | A | 23 |
13 | 17/10/2017 19:00:00 | A | 24 |
14 | 15/10/2017 13:00:00 | B | 25 |
15 | 15/10/2017 14:00:00 | B | 26 |
16 | 15/10/2017 15:00:00 | B | 27 |
17 | 15/10/2017 16:00:00 | B | 28 |
18 | 15/10/2017 20:00:00 | B | 29 |
19 | 15/10/2017 07:00:00 | B | 30 |
20 | 16/10/2017 09:00:00 | B | 31 |
21 | 16/10/2017 12:00:00 | B | 32 |
22 | 16/10/2017 18:00:00 | B | 33 |
23 | 16/10/2017 22:00:00 | B | 34 |
24 | 17/10/2017 10:00:00 | B | 35 |
25 | 17/10/2017 16:00:00 | B | 36 |
26 | 17/10/2017 19:00:00 | B | 37 |
Hi @ImNewUser,
I test using your sample data and get expected result. Please follow the steps below.
1. Create a Calendar table. Create Calculated columns the Year, Month, Day, and the next to days using the formula below.
Year = YEAR('Calendar'[Date]) Month = MONTH('Calendar'[Date]) Day = DAY('Calendar'[Date]) next 2 days = 'Calendar'[Date]+2
2. Create three slicers including Calendar[Year], Calendar[Month], Calendar[Day] separately.
3. Create two measures to get the filtered data and corresponding next two day.
Selected value = SELECTEDVALUE('Calendar'[Date]) next 2 days selected = SELECTEDVALUE('Calendar'[next 2 days])
4. Create a slicer including Table[Area], create two measure to get count value the next two days and selected date as follows.
next 2 days value11 = CALCULATE ( SUM ( Table1[Count] ), FILTER ( Table1, AND ( DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) > [Selected value], DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) <= [next 2 days selected] ) ) ) filtered date = CALCULATE ( SUM ( Table1[Count] ), FILTER ( Table1, DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) = [Selected value] ) )
Please review the expected result as the screenshot shown.
You can download the .pbix file from attachment for more details.
Best Regards,
Angelia
How did you get starting date in table.
I have the similar type of doubt but i did not get the result....
@v-huizhn-msft wrote:Hi @ImNewUser,
I test using your sample data and get expected result. Please follow the steps below.
1. Create a Calendar table. Create Calculated columns the Year, Month, Day, and the next to days using the formula below.Year = YEAR('Calendar'[Date]) Month = MONTH('Calendar'[Date]) Day = DAY('Calendar'[Date]) next 2 days = 'Calendar'[Date]+2
2. Create three slicers including Calendar[Year], Calendar[Month], Calendar[Day] separately.
3. Create two measures to get the filtered data and corresponding next two day.Selected value = SELECTEDVALUE('Calendar'[Date]) next 2 days selected = SELECTEDVALUE('Calendar'[next 2 days])
4. Create a slicer including Table[Area], create two measure to get count value the next two days and selected date as follows.next 2 days value11 = CALCULATE ( SUM ( Table1[Count] ), FILTER ( Table1, AND ( DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) > [Selected value], DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) <= [next 2 days selected] ) ) ) filtered date = CALCULATE ( SUM ( Table1[Count] ), FILTER ( Table1, DATE ( YEAR ( Table1[Starting Date] ), MONTH ( Table1[Starting Date] ), DAY ( Table1[Starting Date] ) ) = [Selected value] ) )
Please review the expected result as the screenshot shown.
You can download the .pbix file from attachment for more details.
Best Regards,
Angelia
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |