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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Create a Table

Hi, I'm new to power bi. I want to create a table from following data set showing date range 6/01/2020 as 6/01/2020 and get average volume and 7/01/2020 - 11/01/2020 as 12/01/2020 and get avearge volume and so on so forth. I need help please. Cheers.

 

DateDate RangeWeek NoVolume
6/01/20206/01/2020218.50
7/01/2020 317.20
8/01/2020 319.50
9/01/2020 314.27
10/01/2020 313.70
11/01/202012/01/2020315.50
12/01/2020 416.30
13/01/2020 418.60
14/01/2020 419.36
15/01/2020 420.54
16/01/202017/01/2020413.12
17/01/2020 517.26
18/01/2020 519.25
19/01/2020 520.23
20/01/2020 520.00
21/01/202022/01/2020515.00
1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, here is my test table:

2.PNG

Then create two columns:

Week No = IF('Table'[Date]=MIN('Table'[Date]),2,IF(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5-ROUND(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5,0)<=1,2+ROUNDUP(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5,0)))
Date Range = IF('Table'[Date]=MIN('Table'[Date]),MIN('Table'[Date]),IF(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5-ROUND(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5,0)=0,'Table'[Date]+1,BLANK()))

It shows:

3.PNG

Create a slicer table:

Slicer Table = FILTER(DISTINCT(SELECTCOLUMNS('Table',"Week No",'Table'[Week No],"Date Range",'Table'[Date Range])),[Date Range]<>BLANK())

1.PNG

Then create relationships between two tables by [Week No] link column as one-to-many:

1.jpg

Create a measure to calculate average volume values:

Measure = AVERAGE('Table'[Volume])

Choose [Date Range] from Slicer Table and this measure as a table visual, the result shows:

5.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

View solution in original post

2 REPLIES 2
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, here is my test table:

2.PNG

Then create two columns:

Week No = IF('Table'[Date]=MIN('Table'[Date]),2,IF(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5-ROUND(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5,0)<=1,2+ROUNDUP(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5,0)))
Date Range = IF('Table'[Date]=MIN('Table'[Date]),MIN('Table'[Date]),IF(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5-ROUND(DATEDIFF(MIN('Table'[Date]),'Table'[Date],DAY)/5,0)=0,'Table'[Date]+1,BLANK()))

It shows:

3.PNG

Create a slicer table:

Slicer Table = FILTER(DISTINCT(SELECTCOLUMNS('Table',"Week No",'Table'[Week No],"Date Range",'Table'[Date Range])),[Date Range]<>BLANK())

1.PNG

Then create relationships between two tables by [Week No] link column as one-to-many:

1.jpg

Create a measure to calculate average volume values:

Measure = AVERAGE('Table'[Volume])

Choose [Date Range] from Slicer Table and this measure as a table visual, the result shows:

5.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

Greg_Deckler
Community Champion
Community Champion

So like this?

Table1 = GROUPBY('Table',[Week No],"Average",AVERAGEX(CURRENTGROUP(),[Volume]))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.