Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Dear experts,
I need to create a visual as below:
| ID | Who take a look | Who actually buy | |||||
| 1 | Yes | Yes | 150 (total sum that ID 1 bought) | ||||
| 2 | Yes | Yes | 120 | ||||
| 3 | Yes | Yes | 341 | ||||
| 4 | Yes | Yes | 220 | ||||
| 5 | Yes | No | |||||
| 6 | Yes | No | |||||
| 7 | Yes | No | |||||
| 8 | Yes | No | |||||
| 9 | No | ||||||
| 10 | No | ||||||
| 11 | Yes | ||||||
| 12 | No |
From 3 tables:
Table 1: A small number of IDs (unique)
| ID |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
Table 2: the biggest data set of IDs contains some IDs from Table 1 and other IDs. There are duplicates (as everytime a particular buyer takes a look to the product, it is recorded, whether they buy or not).
| ID |
| 1 |
| 1 |
| 1 |
| 2 |
| 3 |
| 3 |
| 3 |
| 3 |
| 3 |
| 4 |
| 4 |
| 5 |
| 6 |
| 5 |
| 20 |
| 5 |
| 7 |
| 8 |
| 11 |
| 8 |
| 11 |
Table 3: includes two columns, recording every purchase from whom actually buy after taking a look. Column 1 is a subdata set from IDs in table 2. Column 2 is amount money.
| ID | Amount | |
| 1 | 100 | |
| 1 | 50 | |
| 2 | 120 | |
| 3 | 341 | |
| 4 | 190 | |
| 4 | 30 | |
| 20 | 400 |
I would be grateful for every solution.
Thank you very much!
Solved! Go to Solution.
Hi @BusinessAnalyst,
First, please create a relationship between the tables. In order to create a relationship in a data model in Power Pivot, at least one side of the relationship must be tied to a column that is unique in the table. The ID in table1 is unique, you can create relationship. More details about creating relationship, please review this article.
Then create a calculated column in table3 to get the total sum of each ID bought as the following formula and snapshot.
In table1, create measure look, and create another three calculated columns using the following formulas and get expected result.
Look = COUNTX(RELATEDTABLE(Table2),Table2[ID])
total buy = LOOKUPVALUE(Table3[Total],Table3[ID],Table1[ID])
Who table a look = IF(Table1[Look]>0,"Yes","No")
Who actually buy = IF(Table1[total buy]>0,"Yes","No")
If you have any question, please feel free to ask.
Best Regards,
Angelia
Hi @BusinessAnalyst,
Of course, you can. Just create a calculated column and get the desired result.
Look count = COUNTX(RELATEDTABLE(Table2),Table2[ID])
Best Regards,
Angelia
Hi @BusinessAnalyst,
First, please create a relationship between the tables. In order to create a relationship in a data model in Power Pivot, at least one side of the relationship must be tied to a column that is unique in the table. The ID in table1 is unique, you can create relationship. More details about creating relationship, please review this article.
Then create a calculated column in table3 to get the total sum of each ID bought as the following formula and snapshot.
In table1, create measure look, and create another three calculated columns using the following formulas and get expected result.
Look = COUNTX(RELATEDTABLE(Table2),Table2[ID])
total buy = LOOKUPVALUE(Table3[Total],Table3[ID],Table1[ID])
Who table a look = IF(Table1[Look]>0,"Yes","No")
Who actually buy = IF(Table1[total buy]>0,"Yes","No")
If you have any question, please feel free to ask.
Best Regards,
Angelia
Hi @BusinessAnalyst,
Of course, you can. Just create a calculated column and get the desired result.
Look count = COUNTX(RELATEDTABLE(Table2),Table2[ID])
Best Regards,
Angelia
| User | Count |
|---|---|
| 53 | |
| 42 | |
| 32 | |
| 15 | |
| 13 |
| User | Count |
|---|---|
| 84 | |
| 72 | |
| 37 | |
| 27 | |
| 24 |