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
uayan
Frequent Visitor

Last N weeks on column chart as x axis

I want to create dynamic column chart represents count of project number by week number. 

For example:

uayan_0-1675077785277.png

 

 

I have date column as a date format and date table shows week number.

 

Actually I want to create this chart as last 52 weeks not last 6 months.

uayan_0-1675078271705.png

 

2 REPLIES 2
amitchandak
Super User
Super User

@uayan , if there is no slicer you can get last 52 week using

 

last 52 weeks =
var _min1 = today() -WEEKDAY(today() ,2) +1 //Monday week start
var _max = _min1 +6

var _min = _min1 -(51*7)
return

CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

if you want to select a date/week and then want 52 week, then your slicer need to me on an independent date table

 

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _today= maxx(allselected(Date1),Date1[Date])
var _min1 = _today -WEEKDAY(_today ,2) +1 //Monday week start
var _max = _min1 +6

var _min = _min1 -(51*7)
return

CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

What is the meaning of [Net] ?

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.