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
anastasiyaveko
Frequent Visitor

Create combined table from 2 tables from different tables and measures

Hi all 🙂 

I'm stuck on a task that I haven't been able to complete for a long time. Please help :))

My goal is to understand how well or how poorly we cover customer needs, where we have missed opportunities.
And create table summary. 

 

Customer GroupProductRealPotentialYear
Customer 1Number of SalesBikes1715002016
Customer 1Number of SalesBikes2025002016
Customer 1Number of SalesAccessories 1002016
Customer 1Number of SalesComponents 4002016
Customer 1Number of Products  132016
Customer 1Number of Products  112017



I have the following data :

Calendar Table – A table containing date information.
Internet Sales – Number of orders for various products over the years.
Potential Sales – The potential number of orders that a customer could have in a year.

Potential Sales Table: 
CUSTOMER_NAME N_YEAR Date Potential Number of Orders Product
Customer 1 2016 01.01.2016 500 Bikes
Customer 1 2016 01.01.2016 400 Components
Customer 1 2016 01.01.2016 100 Accessories
Customer 1 2017 01.01.2017 200 Bikes
Customer 2 2020 01.01.2020 400 Bikes
Customer 2 2021 01.01.2021 500 Bikes
Customer 2 2022 01.01.2022 20 Bikes
Customer 2 2024 01.01.2016 500 Bikes


Internet Sales: 
CUSTOMER_NAME N_YEAR Date Number of Orders Product
Customer 1 2016 01.01.2016 1 Bikes
Customer 1 2016 01.01.2016 169 Bikes
Customer 1 2016 01.01.2016 1 Bikes
Customer 1 2017 01.01.2017 154 Bikes
Customer 1 2017 01.01.2017 1 Bikes
Customer 1 2017 01.01.2017 46 Bikes
Customer 1 2017 01.01.2017 1 Bikes
Customer 1 2018 01.01.2018 108 Bikes
Customer 1 2019 01.01.2019 281 Bikes
Customer 1 2019 01.01.2019 3 Bikes
Customer 1 2019 01.01.2019 44 Bikes
Customer 1 2019 01.01.2019 2 Components
Customer 1 2020 01.01.2020 95 Bikes
Customer 1 2020 01.01.2020 17 Bikes
Customer 1 2020 01.01.2020 4 Components
Customer 1 2020 01.01.2020 26 Bikes
Customer 1 2020 01.01.2020 222 Bikes
Customer 1 2020 01.01.2020 4 Bikes
Customer 1 2020 01.01.2020 64 Bikes
Customer 1 2020 01.01.2020 10 Components
Customer 1 2020 01.01.2020 1 Bikes
Customer 1 2021 01.01.2021 96 Bikes
Customer 1 2021 01.01.2021 677 Bikes
Customer 1 2021 01.01.2021 2 Bikes
Customer 1 2021 01.01.2021 258 Bikes
Customer 1 2021 01.01.2021 6 Bikes
Customer 1 2022 01.01.2022 1 Accessories
Customer 1 2022 01.01.2022 50 Bikes
Customer 1 2022 01.01.2022 1 Bikes
Customer 1 2022 01.01.2022 150 Bikes
Customer 1 2022 01.01.2022 20 Bikes
Customer 1 2022 01.01.2022 91 Bikes
Customer 1 2022 01.01.2022 3 Bikes
Customer 1 2023 01.01.2023 6 Bikes
Customer 1 2023 01.01.2023 104 Bikes
Customer 1 2023 01.01.2023 38 Components
Customer 1 2023 01.01.2023 12 Components
Customer 1 2024 01.01.2024 24 Bikes
Customer 1 2024 01.01.2024 80 Components
Customer 2 2020 43831 1 Bikes
Customer 2 2021 44197 38 Bikes
Customer 2 2022 44562 12 Bikes
Customer 2 2023 44927 94 Bikes
Customer 2 2024 45292 8 Bikes
Customer 3 2020 43831 8 Bikes
Customer 2 2019 43466 2 Components

Sales.pngRelation 1.pngRelation 2.pngRelation 3.pngRelation 4.png
CUSTOMER_NAME
Customer 1
Customer 2
Customer 3


I would like to create a table that combines values from two tables, including Measures. 

For example, with Customer 1 in 2016, we had 171 orders for the product "Bikes". But the potential number of orders in this year could have been 500. So, we missed out on 329 orders for this product. I would like to see values in new table, such as: 

Customer Name – Name of Category – Fact Number of Orders – Potential Number of Orders – Year

The "Name of Category" in this case - Number of orders

 

Similarly, regarding the number of products: in 2016, we only sold 1 product category – Bikes, but we know that the customer has a total of 3 product categories. So, we missed out on 2 products.


But for now, I'm getting something like this, the values ​​are not related to each other, and I can't add the customer.
I used: 


Combined =
VAR _a = SUMMARIZE ('Calendar Table','Calendar Table'[Year],"Name of Category", "Number of Products", "Fact", [Fact Number of Products],"Total",[Potential Number of Products])
VAR _b = SUMMARIZE ('Calendar Table','Calendar Table'[Year],"Name of Category", "Category", "Fact", [Fact Number of Orders],"Total",[Potential Number of Orders])
RETURN
UNION(_a,_b)


Sales Combined.png




1 ACCEPTED SOLUTION

Hi @anastasiyaveko ,

 

On the basis of the above, create the following table:

vtianyichmsft_0-1711521791146.png

 

 

Table = ADDCOLUMNS('Internet Sales',"Potential",[Potential],"Real",[Real])

 

 

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

5 REPLIES 5
v-tianyich-msft
Community Support
Community Support

Hi @anastasiyaveko ,

 

I don't know what your custom looks like, so I disconnected them. I made simple samples and you can check the results below:

vtianyichmsft_0-1711357308487.png

Real = var _t = ADDCOLUMNS('Internet Sales',"TOTAL",SUMX(FILTER(ALL('Internet Sales'),[Date]=EARLIER([Date])&&[Customer]=EARLIER([Customer])),[Number]))
RETURN MAXX(_t,[TOTAL])

Potential = var _t = ADDCOLUMNS('Potential Sales Table',"Total",SUMX(FILTER(ALL('Potential Sales Table'),[Product]=EARLIER([Product])&&[Year]=EARLIER([Year])),[Number]))
RETURN MAXX(_t,[Total])

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

Hello! Thank you so much!
And I'm still can't understand how I can create new table with measures in it? 
Like this one?
Customer Group Product Real Potential Year
Customer 1 Number of Sales Bikes 171 500 2016
Customer 1 Number of Sales Bikes 202 500 2016
Customer 1 Number of Sales Accessories 100 2016
Customer 1 Number of Sales Components 400 2016
Customer 1 Number of Products 1 3 2016
Customer 1 Number of Products 1 1 2017


Hi @anastasiyaveko ,

 

On the basis of the above, create the following table:

vtianyichmsft_0-1711521791146.png

 

 

Table = ADDCOLUMNS('Internet Sales',"Potential",[Potential],"Real",[Real])

 

 

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

v-tianyich-msft
Community Support
Community Support

Hi @anastasiyaveko ,

 

Due to the policy, I am unable to download your sample, please provide the data in a table in text form.

 

Best regards,
Community Support Team_ Scott Chang

Hello!
Added and also added all possible information. Hopes it will help.
Thank you 

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.