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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Sut_Datanaut
Helper II
Helper II

want to see sum of value before and after a certain date

I have a standard table that has a date column and a unique id column that i am doing count of to aggregate and see number of unique id's by day. 

 

i also have a seperate table that has a list of events, and their start and end dates. 

 

What i would like to create is a way to capture the total number of unique ID's for the past 6 weeks before the start date, and another value for the 6 weeks after the start date. 

 

the tricky part is that i want to use a slicer to change which event i want to see the totals for. 

 

so essentially the sum of count(unique id's) from 6 weeks back until the selected start date and the sum of count(unique id's) from the start date to 6 weeks in the future. 

 

Thank you, 

1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
VahidDM
Super User
Super User

Hi @Sut_Datanaut 

 

Can you post sample data as text and expected output?
Not enough information to go on;

please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

Hey Vahid, 

 

Below are samples of the two tables, essentially if i have an event, i want to see the sum of the count of unique ID's for a lets say a week before, and then the sum of the count of unique ID's for a week after an event date. 

 

so for this example, if i select event 2 in the slicer, then i want one formula that sums the the count of unique ID's for a week before 1/6/2023 (the start date of event 2) and another than sums a week after 1/6/2023

 

Sut_Datanaut_0-1684422087592.png

 

Hi,

Share the download link of the MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

dont have one drive, but here is a sample of the two tables

 

DateUnique ID
1/1/202365NE5N6E5N6E56N
1/1/2023ERSEVERT5VSEE
1/1/2023SV5SEVSE5EV
1/2/2023S5EVSEVEEVS
1/2/202356NE5E56N5E
1/2/202356NE5E56N5E
1/3/202365N5E6N56N
1/3/202365N5E6N56N
1/4/2023N76N6RE6
1/4/2023N5Y65N566
1/5/2023WN6W4NW4N
1/5/2023W34F3WF
1/6/2023NW6WNWN
1/6/2023W5GW45G
1/7/2023W5G45GW4
1/7/2023W5G45GW4
1/8/202345WG45GW45G
1/8/202345WG45GW45G
1/9/202334G3WGW5
1/9/202334G3WGW5
1/10/20234F432324324F
1/10/20234F432324324F
1/11/2023234F234234
1/11/2023234F234234
1/12/2023234F3GG45
1/12/2023234F3GG45
1/12/2023234F3GG45
1/13/202345G43G5345G
1/13/202345G43G5345G
1/13/202345G43G5345G
1/14/202343G5345G4F
1/14/202343G5345G4F
1/14/202343G5345G4F
1/15/2023F34FF434
1/15/2023F34FF434
1/15/2023F34FF434
1/16/2023X4XQ4T4XQ3
1/16/2023X4XQ4T4XQ3
1/16/2023X4XQ4T4XQ3
1/17/2023Q3X4XX4FQ4
1/17/2023Q3X4XX4FQ4
1/17/2023Q3X4XX4FQ4
1/18/2023Q43X34F5VYVW4
1/18/2023Q43X34F5VYVW4
1/18/2023Q43X34F5VYVW4
1/19/2023V4W4VW4VW4V
1/19/2023V4W4VW4VW4V
1/19/2023V4W4VW4VW4V
1/20/202365NE5N6E5N6E56N
1/20/202365NE5N6E5N6E56N
1/20/202365NE5N6E5N6E56N
1/21/202356NE5E56N5E
1/21/202356NE5E56N5E
1/21/202356NE5E56N5E

 

Start EventEnd EventEvent Name
1/16/20231/23/2023Event 1
1/24/20232/1/2023Event 2

 

Sut_Datanaut_0-1684788716976.png

 

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.