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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
raassd
Helper I
Helper I

Last 18 selected days values

Hi Team,

I have to show last 18 week from selected date and selected day.

 There will be 2 sliceres week number and weekday.

User will select week number(19 2024) & Weekday (Monday) my result should show only monday values of last 18 weeks.

 

Please help me.

 

Thanks !

Rakesh

2 REPLIES 2
v-huijiey-msft
Community Support
Community Support

Hi @raassd ,

 

Please try:

 

Use a DAX measure to calculate the selected date based on the week number and year selected by the user.

Selected Date = 
CALCULATE(
    MAX(DateTable[Date]),
    FILTER(
        ALL(DateTable),
        DateTable[Year] = SELECTEDVALUE(SlicerYearTable[Year]) &&
        DateTable[WeekNumber] = SELECTEDVALUE(SlicerWeekNumberTable[WeekNumber])
    )
)

 

Create a measure, which means that the selected date and the sales volume of the past 18 weeks started in the past 18 weeks.

Last 18 Weeks = 
CALCULATE(
    [Sales], 
    FILTER(
        ALL(DateTable),
        DateTable[Date] <= [Selected Date] &&
        DateTable[Date] > DATEADD([Selected Date], -18, WEEK) &&
        DateTable[Weekday] = SELECTEDVALUE(WeekdaySlicer[Weekday])
    )
)

 

You can replace the 'Sales' with the data you want to calculate.

 

I would appreciate it if you could provide me with example data for testing and remember to erase your private information.

 

If you have other questions, please contact me at any time.

 

Best Regards,
Yang
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!

@v-huijiey-msft ,

Thanks for your Help, 

I need to show the Output as below.

User will select week from Slicer and Day from other slicer it should only show that day value for last 10 weeks.

raassd_0-1709279487380.png

 

 

Thanks !

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.