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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
joshua1990
Post Prodigy
Post Prodigy

Show next 7 weeks based on Selection

Hi all!

I hve a simple sales table that is linked to a calendar table.

Now I would like to create a report (matrix visual) that shows me per article (row) the sales per week (column) based on week selection.

If I select WK01, then I would like to see it this way:

Article WK01 WK02 WK03 WK04 WK05
A 1 3 0 4 3
B 1 3 0 4 4
C 1 3 0 44 4
D 1 3 0 9 3
E 1 0 0 9 5

 

How would you do that?

Do I need a second calendar table ?

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

I would utilize a filter measure:

E.g. this measure shows the next 11 weeks:

11weeks = var _sdate =CALCULATE(MIN('Calendar'[Date]),ALL('Calendar'[Date]),
WEEKDAY('Calendar'[Date],2)=1,
WEEKNUM(TODAY())=WEEKNUM('Calendar'[Date]),
'Calendar'[Date]>TODAY()-7)

var _edate = _sdate + 7*11
var cdate = MAX('Calendar'[Date])
return
IF(cdate>=_sdate&& cdate<=_edate,1,0)

You can make the measure to be dynamic by using another calendar and then referencig that in the dax.

End result:

ValtteriN_0-1668358820674.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/








Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ValtteriN
Super User
Super User

Hi,

I would utilize a filter measure:

E.g. this measure shows the next 11 weeks:

11weeks = var _sdate =CALCULATE(MIN('Calendar'[Date]),ALL('Calendar'[Date]),
WEEKDAY('Calendar'[Date],2)=1,
WEEKNUM(TODAY())=WEEKNUM('Calendar'[Date]),
'Calendar'[Date]>TODAY()-7)

var _edate = _sdate + 7*11
var cdate = MAX('Calendar'[Date])
return
IF(cdate>=_sdate&& cdate<=_edate,1,0)

You can make the measure to be dynamic by using another calendar and then referencig that in the dax.

End result:

ValtteriN_0-1668358820674.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/








Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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