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.
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])
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |