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
FRG
Resolver I
Resolver I

Create a new table

Hi,

I want to create a new table to summurize 2 existing tables. Table1

Capture1.PNG

And the other (not linked with the first) is detail about products, Table2:

Capture.PNG

 

In a new table I want 3 columns:

- The IdProduction (Table1) when idProcess = 2, 

- The count of ID (Table2) when ScaledOn is between TimeShiftBegin and TimeShiftEnd (Table1),

- The sum of volumeDisplay (Table2) when ScaledOn is between TimeShiftBegin and TimeShiftEnd (Table1).

 

Is there a way to do that with Power BI?

Thanks

 

1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @,

 

I’ve created a sample similar with yours: there’re table 1 and table 2

3.png

I use below formulas to generate table 3 and table 4 under your condition:

Table 3 = CALCULATETABLE('Table1',FILTER(Table1,[idProcess]=2))
Table 4 = CALCULATETABLE(Table2,FILTER(Table2,[ScaledOn]>MAX(Table1[TimeShiftBegin])&&[ScaledOn]<MAX(Table1[TimeShiftEnd])))

There’s additional new column added in table 4 for sum of volumeDisplay:

sum of vd = SUM('Table 4'[volumeDisplay])

Then use the crossjoin function to create the final table:

Table = CROSSJOIN(SELECTCOLUMNS('Table 3',"idpro",[IdProduction]),SELECTCOLUMNS('Table 4',"idcount",[ID],"sum of vd",[sum of vd]))

4.png

attached pbix here: 

https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EV50Bj2EiAdLn9nt09Kt1R...

Best regards,

Dina Ye

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

2 REPLIES 2
v-diye-msft
Community Support
Community Support

Hi @,

 

I’ve created a sample similar with yours: there’re table 1 and table 2

3.png

I use below formulas to generate table 3 and table 4 under your condition:

Table 3 = CALCULATETABLE('Table1',FILTER(Table1,[idProcess]=2))
Table 4 = CALCULATETABLE(Table2,FILTER(Table2,[ScaledOn]>MAX(Table1[TimeShiftBegin])&&[ScaledOn]<MAX(Table1[TimeShiftEnd])))

There’s additional new column added in table 4 for sum of volumeDisplay:

sum of vd = SUM('Table 4'[volumeDisplay])

Then use the crossjoin function to create the final table:

Table = CROSSJOIN(SELECTCOLUMNS('Table 3',"idpro",[IdProduction]),SELECTCOLUMNS('Table 4',"idcount",[ID],"sum of vd",[sum of vd]))

4.png

attached pbix here: 

https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EV50Bj2EiAdLn9nt09Kt1R...

Best regards,

Dina Ye

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @FRG ,

 

If my above post helps, could you please consider Accept it as the solution to help the other members find it more quickly. thanks!

 

Best regards,

Dina Ye

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

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.