Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Question:
Show data (not measure) from different column based on selection
How to make the generic field that show value from diff column depending on "PromoType" selection?
By right, i will need to have below formulated field created
[Customer]
[Promo Tag1]
[Promo Tag2]
[Promo Unit]
Requirement:
- Only 1 table is needed
- The Table Field Header will be Generic (Customer/Promo Tag1/ Promo Tag2/Promo Unit), and not Promo1_Tag1/etc etc
- Not only needed the measure sum(unit), but also want to see the Customer/Tag1/Tag2
Note:
There is overlapping of customer purchasing from the 3 Promo (i.e. Sandy buying from 3 Promo)
Sample data
| Customer | Promo1_Tag1 | Promo1_Tag2 | Promo1_Unit | Promo2_Tag1 | Promo2_Tag2 | Promo2_Unit | Promo3_Tag1 | Promo3_Tag2 | Promo3_Unit |
| Abu | |||||||||
| Michelle | Stationery | Pencil | 5 | ||||||
| Michelle | Stationery | Eraser | 1 | Food | Meat | 3 | |||
| Michael | |||||||||
| Sandy | Books | Fiction | 1 | ||||||
| Sandy | Stationery | Books | 3 | Food | Meat | 1 | Books | Novel | 2 |
| Sandy | Stationery | Pencil | 3 | Food | Vegetables | 2 | Books | Cooking | 1 |
| Ming | |||||||||
| Chu | |||||||||
| Sam | Food | Fruits | 1 | ||||||
| Sam | Food | Vegetables | 5 | ||||||
| Andy | |||||||||
| Krishnan | Stationery | Eraser | 1 | Food | Vegetables | 2 | |||
| Samuel | Food | Meat | 2 | Books | Novel | 1 | |||
| Samuel | Food | Fruits | 4 | ||||||
| Katherine | |||||||||
| Jenny | Books | Cooking | 2 | ||||||
| Mr.Ong | Stationery | Pencil | 2 | ||||||
| Ms.Lim | Stationery | Pencil | 1 | Books | Fiction | 2 |
Example of what is needed:-
| 1) will have a simple table created that allow selection of Promo | ||||||||
| PromoType | ||||||||
| Promo1 | ||||||||
| Promo2 | ||||||||
| Promo3 | ||||||||
| 2a) When [PromoType] selected 'Promo1', will show the below | ||||||||
| The Table Field Header will be Generic, and not Promo1/Promo2/Promo3 | If drill up to Promo Tag1, will show | |||||||
| Customer | Promo Tag1 | Promo Tag2 | Promo Unit | Customer | Promo Tag1 | Promo Unit | ||
| Michelle | Stationery | Pencil | 5 | Michelle | Stationery | 6 | ||
| Michelle | Stationery | Eraser | 1 | Sandy | Stationery | 6 | ||
| Sandy | Stationery | Books | 3 | Krishnan | Stationery | 1 | ||
| Sandy | Stationery | Pencil | 3 | Mr.Ong | Stationery | 2 | ||
| Krishnan | Stationery | Eraser | 1 | Ms.Lim | Stationery | 1 | ||
| Mr.Ong | Stationery | Pencil | 2 | |||||
| Ms.Lim | Stationery | Pencil | 1 | |||||
| 2b) When [PromoType] selected 'Promo2', will show below on the same table | If drill up to Promo Tag1, will show | |||||||
| Customer | Promo Tag1 | Promo Tag2 | Promo Unit | Customer | Promo Tag1 | Promo Unit | ||
| Michelle | Food | Meat | 3 | Michelle | Food | 3 | ||
| Sandy | Food | Meat | 1 | Sandy | Food | 3 | ||
| Sandy | Food | Vegetables | 2 | Sam | Food | 6 | ||
| Sam | Food | Fruits | 1 | Krishnan | Food | 2 | ||
| Sam | Food | Vegetables | 5 | Samuel | Food | 6 | ||
| Krishnan | Food | Vegetables | 2 | |||||
| Samuel | Food | Meat | 2 | |||||
| Samuel | Food | Fruits | 4 | |||||
| 2c) When [PromoType] selected 'Promo3', will show below on the same table | If drill up to Promo Tag1, will show | |||||||
| Customer | Promo Tag1 | Promo Tag2 | Promo Unit | Customer | Promo Tag1 | Promo Unit | ||
| Sandy | Books | Fiction | 1 | Sandy | Books | 4 | ||
| Sandy | Books | Novel | 2 | Samuel | Books | 1 | ||
| Sandy | Books | Cooking | 1 | Jenny | Books | 2 | ||
| Samuel | Books | Novel | 1 | Ms.Lim | Books | 2 | ||
| Jenny | Books | Cooking | 2 | |||||
| Ms.Lim | Books | Fiction | 2 |
Solved! Go to Solution.
Hi @luvnet18 ,
You could create a new table.
Divide the original table into three tables and append them using the union() function.
new table =
var table1 = selectedcolumn('table',"customer",[customer],"promo tag1",[promo1_tag1],"promo tag2",[promo1_tag2],"promo unit",[promo1_unit],"promotype","promo1")
var table2 = selectedcolumn('table',"customer",[customer],"promo tag1",[promo2_tag1],"promo tag2",[promo2_tag2],"promo unit",[promo2_unit],"promotype","promo2")
var table1 = selectedcolumn('table',"customer",[customer],"promo tag1",[promo3_tag1],"promo tag2",[promo3_tag2],"promo unit",[promo3_unit],"promotype","promo3")
result
union(table1,table2,table3)
Then create a slicer table:
PromoType
Promo1
Promo2
Promo3
At last create a relationship between new table and slicer table by PromoType column.
Best Regards,
Jay
Hi @luvnet18 ,
You could create a new table.
Divide the original table into three tables and append them using the union() function.
new table =
var table1 = selectedcolumn('table',"customer",[customer],"promo tag1",[promo1_tag1],"promo tag2",[promo1_tag2],"promo unit",[promo1_unit],"promotype","promo1")
var table2 = selectedcolumn('table',"customer",[customer],"promo tag1",[promo2_tag1],"promo tag2",[promo2_tag2],"promo unit",[promo2_unit],"promotype","promo2")
var table1 = selectedcolumn('table',"customer",[customer],"promo tag1",[promo3_tag1],"promo tag2",[promo3_tag2],"promo unit",[promo3_unit],"promotype","promo3")
result
union(table1,table2,table3)
Then create a slicer table:
PromoType
Promo1
Promo2
Promo3
At last create a relationship between new table and slicer table by PromoType column.
Best Regards,
Jay
Need some help please.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 66 | |
| 44 | |
| 40 | |
| 29 | |
| 19 |
| User | Count |
|---|---|
| 200 | |
| 126 | |
| 103 | |
| 70 | |
| 53 |