Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have a query that appends the distinct values from 3 columns into a single field in a new table using a Union . The field names in the source table are
ES_CLUSTER_FIN
SUB_CLUSTER
pi_email_engagement_segment_fk
The new table has two columns Type (which I've defined in the query) and ES_CLUSTER_FIN which is the name of the first field in the UNION. How do I change the query so I can define the name of this second field in the table created? (instead of it just taking the nam of the first field in the union)
Here is the sytnax::
Table =
var eng_cluster = CROSSJOIN(ROW("Type","Engagement Cluster"), VALUES( 'mc contact_density_weekly_volume_campaign'[ES_CLUSTER_FIN]))
var eng_sub_cluster = CROSSJOIN(ROW("Type","Engagement Sub-cluster"), VALUES('mc contact_density_weekly_volume_campaign'[SUB_CLUSTER]))
var email_engagement = CROSSJOIN(ROW("Type","Email Engagement"), VALUES('mc contact_density_selection_join'[pi_email_engagement_segment_fk]))
return UNION(UNION(eng_cluster,eng_sub_cluster), email_engagement)
Solved! Go to Solution.
OK I worked it out.
Moving the return and adding an additional SELECTCOLUMNS renames the field ES_CLUSTER_FIN to "Type Desc"
Table =
var eng_cluster = CROSSJOIN(ROW("Type","Engagement Cluster"), VALUES( 'mc contact_density_weekly_volume_campaign'[ES_CLUSTER_FIN]))
var eng_sub_cluster = CROSSJOIN(ROW("Type","Engagement Sub-cluster"), VALUES('mc contact_density_weekly_volume_campaign'[SUB_CLUSTER]))
var email_engagement = CROSSJOIN(ROW("Type","Email Engagement"), VALUES('mc contact_density_selection_join'[pi_email_engagement_segment_fk]))
var union_table = UNION(UNION(eng_cluster,eng_sub_cluster), email_engagement) return SELECTCOLUMNS(union_table,"Type",[Type],"Type Desc",[ES_CLUSTER_FIN])
OK I worked it out.
Moving the return and adding an additional SELECTCOLUMNS renames the field ES_CLUSTER_FIN to "Type Desc"
Table =
var eng_cluster = CROSSJOIN(ROW("Type","Engagement Cluster"), VALUES( 'mc contact_density_weekly_volume_campaign'[ES_CLUSTER_FIN]))
var eng_sub_cluster = CROSSJOIN(ROW("Type","Engagement Sub-cluster"), VALUES('mc contact_density_weekly_volume_campaign'[SUB_CLUSTER]))
var email_engagement = CROSSJOIN(ROW("Type","Email Engagement"), VALUES('mc contact_density_selection_join'[pi_email_engagement_segment_fk]))
var union_table = UNION(UNION(eng_cluster,eng_sub_cluster), email_engagement) return SELECTCOLUMNS(union_table,"Type",[Type],"Type Desc",[ES_CLUSTER_FIN])
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
76 | |
53 | |
37 | |
31 |
User | Count |
---|---|
101 | |
56 | |
51 | |
45 | |
40 |