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
Anonymous
Not applicable

Dynamatic calculation based on slicer

Hi,

 

I have been struggling with this question for a while.

Here is what I was trying to accomplish: for a selected day, I will show the stats for that day and average stats for the same day of week for the past one year. For example, if the user pick Nov 14, 2019, the first table present the stats for that single day, the second table shows average stats for thursdays between Nov 14, 2018 and Nov 13, 2019. Currently, I am using two groups of slicers and can only accomplish part of t he task. I block the interaction between slicers under step 1 and the second table, so I can get the average stats for all thursdays, but I could not filter out the selected day and define the range of one year.

 

thanks,

 

Capture.PNG

 
10 REPLIES 10
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

To achieve this, you need to build two slicers. For example, you have slicer1, slicer2, visual1 and visual2. You can disable interaction from slicer1 with slicer2 and visual2, and disable interaction from slicer2 with slicer1 and visual1.

 

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

Thanks, Jimmy.

 

Could you give me more details regarding how to use two slicers to filter out the current date in the second visual, and dynamatically select one year data to report on? Thanks,

 

Kathebrine

 

 

@Anonymous ,

 

"ynamatically select one year data to report on" means default value in slicer, right? I would suggest you refer to similar thread below:

https://community.powerbi.com/t5/Desktop/Setting-the-Default-Value-of-a-Slicer/td-p/16442

 

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

Thanks for your response, Jimmy.

 

The post you refered to is interesting, for sure I will be using that in the near future.

 

But my question is more basic than that. I am struggling with calculating stats for same day of week in the past year giving a date. For example, if Novmeber 14, 2019 is selected, I should present average counts for all the Thursday within one year before Novmeber 14, 2019.  Below is what I got so far, but it doesn't give me exactly what I want. Thanks,

 

Avg Shift Offered Calls =
CALCULATE(
    AVERAGEX( VALUES( 'SUMMARY'[DT_DMN_ID]), [Call Offered]),
    DATESBETWEEN('Date'[CALENDAR_DATE],
NEXTDAY(DATEADD(LASTDATE('Date'[CALENDAR_DATE]),-1,YEAR)),
        LASTDATE('Date'[CALENDAR_DATE]))
)
 
Thanks,
 
Katherine

@Anonymous ,

 

Generally, you need to create a week No. column to mark the week No. and 7 days in a week so that you can achieve the average count in a calculate expression.

 

In addtion, if you can share some sample data and give the expected result, I can do further analysis.

 

Community Support Team _ Jimmy Tao

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

Anonymous
Not applicable

@v-yuta-msft 

 

Could you let me know can I share the file with you? I can create some date in excel and load into Power BI, but how to post the file? I don't see an option to attach a file in the post section. Thanks,

 

Katherine

@Anonymous ,

 

You can upload the sample file(please do not use the sensitive data) to onedrive and share the onedrive link.

 

Regards,

Jimmy Tao

Anonymous
Not applicable

@v-yuta-msft 

 

Could you give me hint regarding how to calculate the average? 

 

Thanks,

 

 

Katherine

Anonymous
Not applicable

@v-yuta-msft 

 

Thanks, But my work computer doesn't allow me to install onedrive. I just copy paste the data here. 

 

Here is the data: Calls is the column I want to summarize. I need the average of all the calls for the same weekday for previous year(here I only post 2 month of data, we could do previous two month).

CALENDAR_DATEDate_KeyCalls
1/1/201720170101211
1/2/201720170102242
1/3/201720170103254
1/4/201720170104273
1/5/201720170105239
1/6/201720170106194
1/7/201720170107251
1/8/201720170108258
1/9/201720170109247
1/10/201720170110251
1/11/201720170111283
1/12/201720170112243
1/13/201720170113203
1/14/201720170114250
1/15/201720170115254
1/16/201720170116260
1/17/201720170117244
1/18/201720170118274
1/19/201720170119236
1/20/201720170120208
1/21/201720170121265
1/22/201720170122269
1/23/201720170123242
1/24/201720170124253
1/25/201720170125289
1/26/201720170126258
1/27/201720170127237
1/28/201720170128282
1/29/201720170129258
1/30/201720170130264
1/31/201720170131286
2/1/201720170201278
2/2/201720170202246
2/3/201720170203218
2/4/201720170204250
2/5/201720170205257
2/6/201720170206251
2/7/201720170207272
2/8/201720170208329
2/9/201720170209292
2/10/201720170210222
2/11/201720170211303
2/12/201720170212272
2/13/201720170213276
2/14/201720170214276
2/15/201720170215292
2/16/201720170216258
2/17/201720170217243
2/18/201720170218237
2/19/201720170219297
2/20/201720170220292
2/21/201720170221271
2/22/201720170222297
2/23/201720170223265
2/24/201720170224182
2/28/201720170228316

 

 

Thank you very much!

 

Katherine

Anonymous
Not applicable

Here is the date table:

DAY_OF_WEEK_NAME_ABBRDate_KeyDAY_OF_WEEK_S1S7CALENDAR_DATE
Tue2017010131/1/2017
Wed2017010241/2/2017
Thu2017010351/3/2017
Fri2017010461/4/2017
Sat2017010571/5/2017
Sun2017010611/6/2017
Mon2017010721/7/2017
Tue2017010831/8/2017
Wed2017010941/9/2017
Thu2017011051/10/2017
Fri2017011161/11/2017
Sat2017011271/12/2017
Sun2017011311/13/2017
Mon2017011421/14/2017
Tue2017011531/15/2017
Wed2017011641/16/2017
Thu2017011751/17/2017
Fri2017011861/18/2017
Sat2017011971/19/2017
Sun2017012011/20/2017
Mon2017012121/21/2017
Tue2017012231/22/2017
Wed2017012341/23/2017
Thu2017012451/24/2017
Fri2017012561/25/2017
Sat2017012671/26/2017
Sun2017012711/27/2017
Mon2017012821/28/2017
Tue2017012931/29/2017
Wed2017013041/30/2017
Thu2017013151/31/2017
Fri2017020162/1/2017
Sat2017020272/2/2017
Sun2017020312/3/2017
Mon2017020422/4/2017
Tue2017020532/5/2017
Wed2017020642/6/2017
Thu2017020752/7/2017
Fri2017020862/8/2017
Sat2017020972/9/2017
Sun2017021012/10/2017
Mon2017021122/11/2017
Tue2017021232/12/2017
Wed2017021342/13/2017
Thu2017021452/14/2017
Fri2017021562/15/2017
Sat2017021672/16/2017
Sun2017021712/17/2017
Mon2017021822/18/2017
Tue2017021932/19/2017
Wed2017022042/20/2017
Thu2017022152/21/2017
Fri2017022262/22/2017
Sat2017022372/23/2017
Sun2017022412/24/2017
Mon2017022522/25/2017
Tue2017022632/26/2017
Wed2017022742/27/2017
Thu2017022852/28/2017

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.