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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
harshagraj
Post Partisan
Post Partisan

To get Last 6 weeks in Fiscal week column

Hi all, I have a column called Fiscal Week Number and it has 1-27 weeks(I filtered 2020). Now for a KPI chart i have to display last 6 weeks and i am using C.Billings as a calculated measure . Please help me how to achieve it. I am using POWER BI default KPI card.
@v-jayw-msft 

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @harshagraj 

 

Based on your description, I created data to reproduce your scenario.

Calendar(a calculated table):

 

 

Calendar = CALENDAR(DATE(2020,1,1),DATE(2020,12,31))

 

 


You may create a calculated column and a measure to diplay the data in last 6 weeks before today.

 

 

Calculated column:
weeknum = WEEKNUM('Calendar'[Date])

Measure:
var _cweeknum = WEEKNUM(TODAY())
var _weeknum = SELECTEDVALUE('Calendar'[weeknum])
var _cyear = YEAR(TODAY())
var _year = YEAR(SELECTEDVALUE('Calendar'[Date]))
return
IF(
    _weeknum>=_cweeknum-6&&
    _weeknum<=_cweeknum&&
    _year=_cyear,
    1,
    0
)

 

 

 

Finally you may put the measure in the visual level filter. Here is the result. Today is 4/6/2020.

a3.png

 

Best Regards

Allan

 

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

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @harshagraj 

 

Based on your description, I created data to reproduce your scenario.

Calendar(a calculated table):

 

 

Calendar = CALENDAR(DATE(2020,1,1),DATE(2020,12,31))

 

 


You may create a calculated column and a measure to diplay the data in last 6 weeks before today.

 

 

Calculated column:
weeknum = WEEKNUM('Calendar'[Date])

Measure:
var _cweeknum = WEEKNUM(TODAY())
var _weeknum = SELECTEDVALUE('Calendar'[weeknum])
var _cyear = YEAR(TODAY())
var _year = YEAR(SELECTEDVALUE('Calendar'[Date]))
return
IF(
    _weeknum>=_cweeknum-6&&
    _weeknum<=_cweeknum&&
    _year=_cyear,
    1,
    0
)

 

 

 

Finally you may put the measure in the visual level filter. Here is the result. Today is 4/6/2020.

a3.png

 

Best Regards

Allan

 

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

amitchandak
Super User
Super User

Please create a week Rank,m using week start or week end date. That can we use to get the desired column

Refer this file : https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Top Solution Authors