Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Hi community,
I have a simple table which include only dates (start of the week) and respective percentages. I have already done the dynamic filtering of dates so that if I select any date from the slicer I will get all the dates upto that selected date using the code below.
26-11-2023 | 30% |
17-12-2023 | 55% |
31-12-2023 | 75% |
How can we acheive this. Is there any modfication that we can do in the existing measure itself ?
Thanks in advance.
Hi team,
Any solutuon for the problem ?
Thank you so much @Anonymous
We are almost there but I'am getting something different than I expected. On the top chart I'am having raw data and below is the modified one. So when selecting 07-01-2024, I think it's not grouping but filtering it maybe
So the expected output looking for is:
26-11-2023 | 50% |
03-12-2023 | 55% |
24-12-2023 | 67.5% |
07-01-2024 | 40% |
We can see it grouped in 2 weeks bin and taken the average.
Hi @JunedS
I don't understand the logic of the grouping, Based on your original output, don't you want to implement a return date every 14 days?
Best Regards!
Yolo Zhu
Hi @Anonymous
Let me clarify the logic behind the grouping. Instead of setting a return date every 14 days from the selected date, the idea is to group the dates into bins of two weeks each based on the chosen date in the slicer. This means we're organizing the dates into two-week intervals, but we're not directly grouping the selected date itself.
Imagine the user selects a date in the slicer, and let's use January 7th, 2024, as an example. With the grouping logic based on two-week bins, it might look like this:
Hi @JunedS
You can try the following measure.
Average CTSP =
VAR NumOfDays =
- MIN ( 'Sample'[Snapshot Week] )
VAR ReferenceDate =
MAXX ( ALLSELECTED ( 'Sample' ), [Snapshot Week] )
VAR PreviousMinDate =
CALCULATE (
MIN ( 'Previous Week'[Snapshot Week] ),
DATESINPERIOD ( 'Previous Week'[Snapshot Week], ReferenceDate, NumOfDays, DAY )
)
VAR Generatedate =
GENERATESERIES ( PreviousMinDate, ReferenceDate, 14 )
VAR Result =
CALCULATE (
AVERAGE ( 'Sample'[CTSP %] ),
REMOVEFILTERS ( 'Sample'[Snapshot Week] ),
FILTER ( 'Previous Week', [Snapshot Week] IN Generatedate ),
USERELATIONSHIP ( 'Previous Week'[Snapshot Week], 'Sample'[Snapshot Week] )
)
RETURN
Result
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the May 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
15 | |
9 | |
8 | |
8 | |
5 |