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
dottoreh2
New Member

Merge two tables with only dates in common, but table1 have 2 values on one and one value on table2

I have two tables, the first looks something like this

 

DateAmountStore
12/26/2022$35,833.121
1/16/2023$13,282.462
1/16/2023$62,436.071
1/17/2023$11,978.662
1/17/2023$114,619.781

 

I also have another table with the data from another store taht looks like this

DateAmount on Store 3
02/01/2024$46,592.26
03/01/2024$12,589.58
04/01/2024$11,753.65
05/01/2024$17,233.93
08/01/2024$33,758.32

 

I've tried to merge both tables but I end up with duplicate values on store 3, because I have two dates on table 1.

 

How can I merge the tables or get a calculated value that sums up all 3 stores?

 

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

Your solution is great @audreygerred 

Hi, @dottoreh2 

If you don't merge your tables, your DAX expression might look something like this:

Amount store12 =
SUMX ( ALL ( 'Table' ), 'Table'[Amount] )
Amount store3 = SUMX(ALL(Table1),'Table1'[Amount on Store 3])
Amount123 = [Amount store12] + [Amount store3] 

Create the above three measures and put them into the card visual, and the result is as follows:

vjianpengmsft_0-1714539922088.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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-jianpeng-msft
Community Support
Community Support

Your solution is great @audreygerred 

Hi, @dottoreh2 

If you don't merge your tables, your DAX expression might look something like this:

Amount store12 =
SUMX ( ALL ( 'Table' ), 'Table'[Amount] )
Amount store3 = SUMX(ALL(Table1),'Table1'[Amount on Store 3])
Amount123 = [Amount store12] + [Amount store3] 

Create the above three measures and put them into the card visual, and the result is as follows:

vjianpengmsft_0-1714539922088.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

audreygerred
Super User
Super User

Hi! You can go to Power Query, go to your second table (the one with Amount on Store 3), rename Amount on Store 3 to Amount so that it aligns with the naming of the first table. Then, add a custom column named Store and have the value be 3. Now your two tables have the same columns. Next, click the down arrow on Append Queries, select Append Queries as New select your two tables to append and click OK. They are now one table. Finally, right click on both of the individual queries of your two separate tables and uncheck 'Enable load'. This way, only the appended table appears in Power BI. Once you have that, you can make a measure for the sum = SUM('YourTable'[Amount]).




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.