Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

data per week

hiii

 

i have created my sla per month now i want it to be showed as per week and i have a slicer that shows months.

what i want to do is i need a slicer for weeks if i click on a week it should show the calculations for that week.

my week start from monday to sunday

can some sow me how can i do that i am attaching my pbix file as well.

https://drive.google.com/file/d/1BqXcqHerCJ4DuGIjl757X3jlDXZz4iQ8/view?usp=sharing

 

 

  • Hi Anonymous ,

     

    Do you want to create another measure that changes with Week?

    If yes, we can create the weeknum column and two measures to meet your requirement.

     

    1. Create week columns in Table.

     

    weeknum = WEEKNUM('Table'[Call Closed],2)
    weekName = "Week"&" "&WEEKNUM('Table'[Call Closed],2)

     

     

    2. Then we can create a slicer using the weekName column. And create two measures.

     

    selected week num = 
    var _x = SELECTEDVALUE('Table'[weekName], "Week 1")
    return
    CALCULATE(MAX('Table'[weeknum]),FILTER('Table','Table'[weekName]=_x))
    

     

    RAW_SLA% _Week = 
    CALCULATE (
        [RAW SLA%],
        filter (Query1,
            WEEKNUM(query1[Call Closed]) = [selected week num]
                
        )
    )
    

     

     

    If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

    It will be helpful if you can show us the exact expected result based on the tables.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

     

    BTW, pbix as attached.

3 Replies

  • Anonymous , How create a choice Week

    https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Power-BI-Turning/ba-p/1187482

     

    Column in date Table //you can use a week table if need , just create correct rank

    Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
    Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
    Week Number = WEEKNUM([Date],2)
    Week = if('Date'[Week Number]<10,'Date'[Year]*10 & 'Date'[Week Number],'Date'[Year]&'Date'[Week Number])
    Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
    Week name = [Week Start date] & " to "& [Week End date]
    Weekday = WEEKDAY([Date],2)
    WeekDay Name = FORMAT([Date],"ddd")

     

     

    Measures

    Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
    This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
    Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
    Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))
    Last 8 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-8 && 'Date'[Week Rank]<=max('Date'[Week Rank])))

     

    Power BI — 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

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Community Support

    Hi Anonymous ,

     

    Do you want to create another measure that changes with Week?

    If yes, we can create the weeknum column and two measures to meet your requirement.

     

    1. Create week columns in Table.

     

    weeknum = WEEKNUM('Table'[Call Closed],2)
    weekName = "Week"&" "&WEEKNUM('Table'[Call Closed],2)

     

     

    2. Then we can create a slicer using the weekName column. And create two measures.

     

    selected week num = 
    var _x = SELECTEDVALUE('Table'[weekName], "Week 1")
    return
    CALCULATE(MAX('Table'[weeknum]),FILTER('Table','Table'[weekName]=_x))
    

     

    RAW_SLA% _Week = 
    CALCULATE (
        [RAW SLA%],
        filter (Query1,
            WEEKNUM(query1[Call Closed]) = [selected week num]
                
        )
    )
    

     

     

    If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

    It will be helpful if you can show us the exact expected result based on the tables.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

     

    BTW, pbix as attached.

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Community Support

    Hi Anonymous ,

     

    How about the result after you follow the suggestions mentioned in my original post?

    Could you please provide more details or expected result about it If it doesn't meet your requirement?

    If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly.

     

    Best regards,

     

    Community Support Team _ zhenbw

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