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

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.

Reply
Anonymous
Not applicable

Create a measure that combines measures into same column

Hi everyone,

 

I need to create a measure that combines column values and measures into one table. I had to create custom measures to get a custom count value for INT0 from another table. 

 

Table 1

INTRANK MEASURECount Measure
INT0570

 

Table 2 

INT RANK ColumnCount Measure
INT120
INT240
INT330
INT40
INT510

 

Desired outcome appends both together with both measures combined in same columns

Table 3

INT RANKCOUNT
INT0570
INT120
INT2

40

INT3

30

INT4

0

INT5

10

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

Try

Create a new Table

 

Union(
selectcolumns(Table1, Table1[INTRANK MEASURE],"Count Measure" , sum(Table1[Count Measure])),
selectcolumns(Table2, Table2[INTRANK MEASURE], "Count Measure", sum(Table2[Count Measure]))
)
OR
Union(
selectcolumns(Table1, "INTRANK MEASURE",Table1[INTRANK MEASURE],"Count Measure" ,Table1[Count Measure]),
selectcolumns(Table2,"INTRANK MEASURE" ,Table2[INTRANK MEASURE],"Count Measure" ,Table2[Count Measure])
)

 

 

OR a new dimension table and join with both the tables

 

Union(
all(Table1[INTRANK MEASURE]),
all(Table2[INTRANK MEASURE])
)

 

And create a new measure

Count = sum(Table1[Count Measure])+ sum(Table2[Count Measure])

 

 

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can try this measure to create a new table:

Table 3 =
UNION (
    SELECTCOLUMNS (
        'Table',
        "INT RANK", 'Table'[INTRANK MEASURE],
        "COUNT", 'Table'[Count Measure]
    ),
    SELECTCOLUMNS (
        'Table 2',
        "INT RANK", 'Table 2'[INT RANK Column],
        "COUNT", 'Table 2'[Count Measure]
    )
)

 You will get the expected result:

combine columns.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous ,

Try

Create a new Table

 

Union(
selectcolumns(Table1, Table1[INTRANK MEASURE],"Count Measure" , sum(Table1[Count Measure])),
selectcolumns(Table2, Table2[INTRANK MEASURE], "Count Measure", sum(Table2[Count Measure]))
)
OR
Union(
selectcolumns(Table1, "INTRANK MEASURE",Table1[INTRANK MEASURE],"Count Measure" ,Table1[Count Measure]),
selectcolumns(Table2,"INTRANK MEASURE" ,Table2[INTRANK MEASURE],"Count Measure" ,Table2[Count Measure])
)

 

 

OR a new dimension table and join with both the tables

 

Union(
all(Table1[INTRANK MEASURE]),
all(Table2[INTRANK MEASURE])
)

 

And create a new measure

Count = sum(Table1[Count Measure])+ sum(Table2[Count Measure])

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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