Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Wk 1-3

Hi All,
I'm trying to calculate from week1-3. I need help. 

 

2 Replies

  • Anonymous , not very clear. But with help from a week rank column

     

    Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
    OR
    Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

     

    You can have measures like
    This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
    Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
    Last year Week= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))
    Last 8 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-8 && 'Date'[Week Rank]<=max('Date'[Week Rank])))

     

    Power BI — Week on Week and WTD
    https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
    https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
    https://www.youtube.com/watch?v=pnAesWxYgJ8

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    I have created a simple sample, please refer to it to see if it helps you.

    Create a weeknum column.

    weeknum = WEEKNUM(Sheet4[date])

    Then create a measure.

    Measure = var start_=1
    var _end=3
    return
    CALCULATE(SUM(Sheet4[value]),FILTER(ALL(Sheet4),Sheet4[weeknum]>=start_&&Sheet4[weeknum]<=_end))

    If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

     

    Best Regards
    Community Support Team _ Polly

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