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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not applicable

DAX showing the last 5 values w/ the same day of week (e.g. Tues only) as my from selcted week nmbr

I'm currently doing a daily dashboard with a different sales value per day. So basically I want to create a matrix visual only showing the sales for the same day the past 5 weeks. For example, I will select week 23 and I selected  Monday, I want the visual to show only Monday, last Monday, Monday weeks ago, Monday 3 weeks ago in a Matrix. And I want this to be dynamic...so i select Tuesday, then Tuesday data from the past 5 weeks should show, then Wednesday, only Wednesday and so on. 

 

Is there any DAX formula that I could use to do this? Thank you!!! I've been trying to go this direction but have been failing :


Thank you.
1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Anonymous 
You have to create a calendar table with the needed columns (weekday, week number)

Ritaf1983_0-1709611795009.png

Ritaf1983_1-1709611845723.png

The week number and day can be used in slicers :

Ritaf1983_2-1709611911735.png

Then you can create measures for the week's sales with wanted offsets:

current week sales = [total_sales]
last week salaes = CALCULATE([curent week sales],DATEADD('Calendar'[Date],-7,DAY))
2 weeks ago sales = CALCULATE([Total sales (K/$)],DATEADD('Calendar'[Date],-14,DAY))
.
.
.
To make the choice which measures to show you can use a field parameters :
Ritaf1983_3-1709612223390.pngRitaf1983_4-1709612294309.pngRitaf1983_5-1709612332942.png

pbix with an example is attached.

More guides about creating calendar tables is by the link:

https://radacad.com/do-you-need-a-date-dimension

About field parameters :

https://www.youtube.com/watch?v=NVREYTHxBvU

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @Anonymous 
You have to create a calendar table with the needed columns (weekday, week number)

Ritaf1983_0-1709611795009.png

Ritaf1983_1-1709611845723.png

The week number and day can be used in slicers :

Ritaf1983_2-1709611911735.png

Then you can create measures for the week's sales with wanted offsets:

current week sales = [total_sales]
last week salaes = CALCULATE([curent week sales],DATEADD('Calendar'[Date],-7,DAY))
2 weeks ago sales = CALCULATE([Total sales (K/$)],DATEADD('Calendar'[Date],-14,DAY))
.
.
.
To make the choice which measures to show you can use a field parameters :
Ritaf1983_3-1709612223390.pngRitaf1983_4-1709612294309.pngRitaf1983_5-1709612332942.png

pbix with an example is attached.

More guides about creating calendar tables is by the link:

https://radacad.com/do-you-need-a-date-dimension

About field parameters :

https://www.youtube.com/watch?v=NVREYTHxBvU

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.