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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.