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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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