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
ivandelgra
Helper I
Helper I

How to create an input table pivoting field from multiple tables

Hello this is the situation:

 

I have multiple tables based on Type of school:

 

Primary school TablePrimary school TableSecondary school TableSecondary school Table

Then I have a table with the Max People Capacity regardless the Type of school

 

 

Daily capacity TableDaily capacity Table

And at the end I have a Calendar Table

Calendar TableCalendar Table

The tables have these relationships:

RelationshipsRelationships

Moreover I have 2 Measures:

 

Total no. of People

 

Tot. no of People = 
SUM(Primaryschool_Table[No. of People]) 
+ SUM(Secondaryschool_Table[No. of People])

and the Availabilty Measure (Max daily Capacity-Tot. no of People)

 

 

 

Availability Measure = 
SUM(DailyCapacity_Table[Daily Max people capacity])
-SUM(Primaryschool_Table[No. of People])
-SUM(Secondaryschool_Table[No. of People])

 

 

I need to create an input table with "Date", "City" and the associate "Availability" as follow:

 

Tot. Availabilty by date.JPG

I need it as an input table in the data model, in order to create additional Measures based on it (e.g. Sum all city with Availabilty > 40).

 

Perhaps I was verbose, but it was necessary to make the picture clear. I thank you all of us who can help me!!! I'm trying to solve this since 2 weeks!

 

 

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

It'd be an awful lot easier if you merged your primary and secondary tables together...

View solution in original post

5 REPLIES 5
ivandelgra
Helper I
Helper I

Hello this is the situation:

 

I have multiple tables based on Type of school:

 

Primary school TablePrimary school TableSecondary school TableSecondary school Table

Then I have a table with the Max People Capacity regardless the Type of school

 

 

Daily capacity TableDaily capacity Table

And at the end I have a Calendar Table

Calendar TableCalendar Table

And the tables have these relationships:

RelationshipsRelationships

Moreover I have 2 Measures:

 

Total no. of People

 

Tot. no of People = 
SUM(Primaryschool_Table[No. of People]) 
+ SUM(Secondaryschool_Table[No. of People])

and the Availabilty Measure (Max daily Capacity-Tot. no of People)

 

 

 

Availability Measure = 
SUM(DailyCapacity_Table[Daily Max people capacity])
-SUM(Primaryschool_Table[No. of People])
-SUM(Secondaryschool_Table[No. of People])

 

 

I need to create an input table with "Date", "City" and the associate "Availability" as follow:

 

Tot. Availabilty by date.JPG

I need it as an input table in the data model, in order to create additional Measures based on it (e.g. Sum all city with Availabilty > 40).

 

Perhaps I was verbose, but it was necessary to make the picture clear. I thank you all of us who can help me!!! I'm trying to solve this since 2 weeks!

 

 

Anonymous
Not applicable

Hi @ivandelgra

 

You can have the sample data for all 4 tables in an excel and attach the file here.

 

Thanks

Raj

First, very good post, you presented out all of the information required. Only complaint is could you post sample data in a format that can be copied and pasted? I'm too lazy to type data by hand. 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
jthomson
Solution Sage
Solution Sage

It'd be an awful lot easier if you merged your primary and secondary tables together...

Thank you so much @jthomson.

 

But I do not know if in the actual situation I can do this.

I actually have:

- millions of records

- 6 types of schools tables

- the columns of the different 'type of school table' are different

- in the primaryschool_table there is a single record for any single building, while in the others tables they are grouped by location as in the example

 

Of course all of tables have 1 column that contains the No. of people (but with different detail aggregation depending on the table).

Do you think that I should create a single enormous Table? (maybe working with the 'group by' feature in query editor regarding the primary school table?)

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.