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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sherishamarri
New Member

Merge queries to get everything in one table

Hello All,

 

I'm new to pwerbi and I have requirememt where we need to get data forn 3 different tables in to one table.

I have tried with merge queries and DAX formulas but the result is not that i expected, It is returning rows from all tables getting duplicate values.

And also there is a condition that for expense category F&B should be divided in to all attendees and speaker who ever attended the program EX:( for program 1 if attendee count is 3 and F&B is 300$ it should divide the amount to 100$ for each attendee and speaker but for category ffs only speaker data should reurn as ffs will only applies to speaker)

Sometimes for cancelled program no attendees will be there so I'm adding another table "Speaker" to get the amount of speakers ffs.

I have atteched the Expected Result Table for your reference.

I'm missing something easy may be but struck here form last 4 days.

Any help highly appreciated.

 

 

sherishamarri_0-1709837789195.png

 

 

 

 

sherishamarri_1-1709837826886.png

sherishamarri_2-1709837865520.png

 

sherishamarri_3-1709837911747.png

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

Hi @sherishamarri 

 

You can follow below steps to get what you want. 

 

1. Rename columns in "Speaker" table to make them the same as those in "Attendee". 

2. Append "Speaker" table to "Attendee". Append queries - Power Query

3. Merge "Attendee" to "Expense" by "Pgm Name" column with left outer. 

4. Add three custom columns one by one:

Modified Attendee:

if [Category] = "FFS" then Table.SelectRows([Attendee], each [Type] = "Speaker") else [Attendee]

Count:

Table.RowCount([Modified Attendee])

New Amount:

[Amount]/[Count]

5. Expand the first custom column and only select the columns you need to expand. 

6. Remove unnecessay columns and rename columns. 

 

The final expense table:

vjingzhanmsft_0-1709891144930.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

3 REPLIES 3
v-jingzhan-msft
Community Support
Community Support

Hi @sherishamarri 

 

You can follow below steps to get what you want. 

 

1. Rename columns in "Speaker" table to make them the same as those in "Attendee". 

2. Append "Speaker" table to "Attendee". Append queries - Power Query

3. Merge "Attendee" to "Expense" by "Pgm Name" column with left outer. 

4. Add three custom columns one by one:

Modified Attendee:

if [Category] = "FFS" then Table.SelectRows([Attendee], each [Type] = "Speaker") else [Attendee]

Count:

Table.RowCount([Modified Attendee])

New Amount:

[Amount]/[Count]

5. Expand the first custom column and only select the columns you need to expand. 

6. Remove unnecessay columns and rename columns. 

 

The final expense table:

vjingzhanmsft_0-1709891144930.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Thank you so much, this helped alot!!!!

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors