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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ChoiJunghoon
Helper III
Helper III

Create New Table with Dax

Hello  

I want to create the result table with Dax. 
Could you help me ? 
TableA

CatergoryValue
A5
B8
C12

 

TableB

CatergoryCharge
A2
B3
C4

 

ResultTable

CategoryNumber
A6
A7
B9
B10
B11
C13
C14
C15
C16
1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

 

SELECTCOLUMNS(
    GENERATE(
        TableA,
        var Val = TableA[Value]
        var Cat = TableA[Category]
        var Chrg = 
            LOOKUPVALUE(
                TableB[Charge],
                TableB[Category], Cat,
                BLANK()
            )
        var Nums = 
            SELECTCOLUMNS(
                GENERATESERIES(
                    Val + 1, 
                    Val + Chrg,
                    1
                ),
                "@Number", [Value]
            )
        return
            Nums
    ),
    "Category", TableA[Category],
    "Number", [@Number]
)

View solution in original post

3 REPLIES 3
daxer-almighty
Solution Sage
Solution Sage

Another way would be:

SELECTCOLUMNS(
    GENERATE(
        NATURALINNERJOIN(
            TableA,
            TableB
        ),
        var Val = TableA[Value]
        var Cat = TableA[Category]
        var Chrg = TableB[Charge]
        var Nums = 
            SELECTCOLUMNS(
                GENERATESERIES(
                    Val + 1, 
                    Val + Chrg,
                    1
                ),
                "@Number", [Value]
            )
        return
            Nums
    ),
    "Category", TableA[Category],
    "Number", [@Number]
)
daxer-almighty
Solution Sage
Solution Sage

 

SELECTCOLUMNS(
    GENERATE(
        TableA,
        var Val = TableA[Value]
        var Cat = TableA[Category]
        var Chrg = 
            LOOKUPVALUE(
                TableB[Charge],
                TableB[Category], Cat,
                BLANK()
            )
        var Nums = 
            SELECTCOLUMNS(
                GENERATESERIES(
                    Val + 1, 
                    Val + Chrg,
                    1
                ),
                "@Number", [Value]
            )
        return
            Nums
    ),
    "Category", TableA[Category],
    "Number", [@Number]
)

Thank you So much!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.