Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

how to rename several columns with a function UNION and SUMARIZE ?

Hello,

 

I did not understand the found message in your site for same question that this...

 

because, I developped the simple function union and sumarize with the same name of columns for 2 or several tables. It works well.

 

Now, I developp using this function with the different names of columns. how do to do it ?

  

----

Table Map1 = VAR mytable =
UNION (
SUMMARIZE ( Change_ref; Change_ref[Number];Change_ref[Users_ref.conso_entity];Change_ref[Planned end date];"Change");
SUMMARIZE ( incidents_ref;incidents_ref[Number];incidents_ref[GIO Entity Code];incidents_ref[Opened];"incident" )
 
)
Return
SELECTCOLUMNS(mytable; "Number"; [Number];"Name_Entity";[Name_Entity];  ==> this isn't well !...there is an displayed error.
 
I would like as in a SQL
(Select 
Change_ref[Number]  as Number ;
Change_ref[Users_ref.conso_entity] as Name_Entity;
Change_ref[Planned end date] as "W_Date";
"Change" as "Typ_Doc")
from Change_ref )
UNION (
Select
incidents_ref[Number] as "Number";
incidents_ref[GIO Entity Code] as "Name_Entity";
incidents_ref[Opened] as "W_Date";
"incident" as "Typ_Doc" 
from incidents_ref)
 
How do to do it in Dax ?
 
Thank you in advance for your help 
sincerely
3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please update your formula like that.

Table Map1 = 
VAR mytable =
    UNION (
        SUMMARIZE (
            Change_ref,
            Change_ref[Number],
            Change_ref[Users_ref.conso_entity],
            Change_ref[Planned end date],
            "a", "Change"
        ),
        SUMMARIZE (
            incidents_ref,
            incidents_ref[Number],
            incidents_ref[GIO Entity Code],
            incidents_ref[Opened],
            "b", "incident"
        )
    )
RETURN
    SELECTCOLUMNS (
        mytable,
        "Number", [Number],
        "Name_Entity", [Users_ref.conso_entity],
        "aaa", [a]
    )

Capture.PNG

 

Pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

hi,

 

Thank you for your answer.

I didn't understand it .

Because, I don't see how to fill in from 3 last differents columns to "selectcolumn"!...

a1.pngtables

Normalement, we Should put the same orders of the columns with respect to the 2 origin tables ... 

But there, I noticed  that a column is missing !...

 

how to do to fill in the final table from severals columns with differentsnames of columnes of differents tables ?  

Hi @Anonymous ,

 

Kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors