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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
UKFan14
Frequent Visitor

Need Help Finding a way to slice based on last 4 weeks etc

Hi There,

I have a column called "Fiscal Week Start" in week increments. 

I have another column called "Actual Sales".

 

 

I want to somehow have a slicer that will look at the "Fiscal Week Start" column and take the most recent date/row that
has a total > than 0 in the "Actual Sales" column. I want to do this for the latest Week, 4 Weeks, 12 weeks and 52 weeks.

 

UKFan14_0-1692140598904.png

 

So for instance the slicer would say L52, L24, L12, L4 , LW... 

LW would only show 7/23/2023 sales, L4 would only show sales for the data in the rows with dates 7/23, 7/16, 7/09, 7/02
Power BI Time Period Help.xlsx

 

Thanks!

4 REPLIES 4
mickey64
Super User
Super User

For your reference.

 

Step 1: I made a parameter table 'Week List'.

mickey64_1-1692156782069.png

 

Step 2: I made a calendar table.

mickey64_3-1692156944348.png

 

Step 3: I made a relastionship.

mickey64_4-1692156983900.png

 

Step 4: I made some measures.

M_Select Week = SELECTEDVALUE('Week List'[Days])
M_LASTDATE = LASTDATE(ALL('Sheet1'[Fiscal Week Start_2]))
M_FIRSTDATE = [M_LASTDATE]-[M_Select Week]
M_Sum Selected Week = CALCULATE(SUM(Sheet1[Actual Sales]),DATESBETWEEN('Calendar'[Date],[M_FIRSTDATE],[M_LASTDATE]))
 

Step 5: I made a slicer.

mickey64_6-1692157343867.png

 

mickey64
Super User
Super User

Sorry.

I added a column below... 

 

Fiscal Week Start_2 = IF([Actual Sales]>0,[Fiscal Week Start])

 

mickey64_0-1692154933621.png

 

mickey64
Super User
Super User

I made a measure and 2 columns.

 

mickey64_4-1692146804326.png

 

mickey64_0-1692146603289.png

 

mickey64_1-1692146638593.png

 

mickey64_3-1692146750402.png

 

Thanks for trying to help out!

Unfortunately, I would need only the dates that had above a 0 in the "actual sales column". At least the way I have the formula, It is just taking the latest date in my table.

Also, I am trying to get a slicer that doesnt take 4 weeks ago, but the last 4 weeks in summation/aggregate.

So L4 would not just be June 8th 2024 in the below example, but the 3 weeks above it as well.

THank you

UKFan14_0-1692148495901.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.