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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors