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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
RMV
Helper V
Helper V

combining data

Hi,

 

I have a formula to combine 2 tables

Table 1.

Date           Category            Additional Category       Qty

1-Jan-17       A                        Add-1                           10

1-Jan-17       B                                                              7

2-Jan-17       A                        Add-1                            2

2-Jan-17       A                                                             15

3-Jan-17       C                                                              4

 

Table 2 combines Table 1 & converting Additional Category = "Add-1" entries to Category C

the formula is

UNION (

SELECTCOLUMNS( FILTER(Table1,Table1[Additional Category] = "Add-1"),

"Date",Table1[Date],

"Category",SUBSTITUTE(Table1[Category],"A","C"),

"Qty",Table1[Qty]))

 

Thus, the result I expected is

Category       Qty

A                    27 (10+2+15)

B                     7

C                    29 (10+2+4, which comes from Qty from Category = C & Additional Category = Add-1)

 

However, what I got is

Category       Qty

A                    27 (10+2+15)

B                     7

C                    4

It seems that the Qty from Additional Category = Add-1 where the Category has been changed from "A" to "C" is not included in the Category C.

 

Is there anything wrong in my formula?

Need advise. Thanks.

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @RMV,

 

It seems your formula is incomplete. I created a new one. Would you like to try it?

 

Table 2 =
SUMMARIZE (
    'Table1',
    Table1[Category],
    "Value", IF (
        'Table1'[Category] = "C",
        CALCULATE (
            SUM ( Table1[QTY] ),
            FILTER (
                ALL ( 'Table1' ),
                'Table1'[Category] = "C"
                    || 'Table1'[Additional Category] = "Add-1"
            )
        ),
        SUM ( Table1[QTY] )
    )
)

combining data.JPG

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

View solution in original post

2 REPLIES 2
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @RMV,

 

It seems your formula is incomplete. I created a new one. Would you like to try it?

 

Table 2 =
SUMMARIZE (
    'Table1',
    Table1[Category],
    "Value", IF (
        'Table1'[Category] = "C",
        CALCULATE (
            SUM ( Table1[QTY] ),
            FILTER (
                ALL ( 'Table1' ),
                'Table1'[Category] = "C"
                    || 'Table1'[Additional Category] = "Add-1"
            )
        ),
        SUM ( Table1[QTY] )
    )
)

combining data.JPG

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

Hi @v-jiascu-msft, thanks for the help.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors