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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ChoiJunghoon
Helper III
Helper III

Create the new table with DAX considering Space.

Hello. 
Can Dax create the below the table ? 

TableA

SpaceNumber
3

 

TableB

CategorySpaceNumberCycle
A15
B25
C34
D14
E23
F34
G14
H25
I33

 

ResultTable

CategorySpaceNumberCycleIndex
A11
A12
A13
A14
A15
B21
B22
B23
B24
C31
C32
C33
C34
D16
D17
D18
D19
E26
E27
E28
F35
F36
F37
F38
G110
G111
G112
G113
H29
H210
H211
H212
H213
I39
I310
I311

 

2 ACCEPTED SOLUTIONS
MattAllington
Community Champion
Community Champion

Not DAX, but yes to power query. 
load table B to PQ

add a new column that creates a a list from 1 to the value in number cycle. It would look something like this. 

={1..[NumberCycle]}

this will give a column  containing lists. You should be able to expand this column into new rows. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

Anonymous
Not applicable

define table
    TableB =
        DATATABLE(
            "Category", STRING,
            "SpaceNumber", INTEGER,
            "Cycle", INTEGER,
            {
                {"A", 1, 5},
                {"B", 2, 4},
                {"C", 3, 4},
                {"D", 1, 4},
                {"E", 2, 3},
                {"F", 3, 4},
                {"G", 1, 4},
                {"H", 2, 5},
                {"I", 3, 3}
            }
        )
EVALUATE
SELECTCOLUMNS(
    GENERATE(
        TableB,
        var Cycle_ = TableB[Cycle]
        var SpaceNumber_ = TableB[SpaceNumber]
        var Category_ = TableB[Category]
        var CycleIndexStart = 
            1 + SUMX(
                filter(
                    TableB,
                    TableB[SpaceNumber] = SpaceNumber_
                    &&
                    TableB[Category] < Category_
                ),
                TableB[Cycle]
            )
        var CycleIndex_ =
            GENERATESERIES(
                CycleIndexStart,
                CycleIndexStart + Cycle_ - 1, 1
            )
        return
            CycleIndex_
    ),
    "Category", TableB[Category],
    "SpaceNumber", TableB[SpaceNumber],
    "CycleIndex", [Value]
)

Execute this code in DAX Studio... By the way, your result table from above has mistakes in it. Mine seems to work correctly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

define table
    TableB =
        DATATABLE(
            "Category", STRING,
            "SpaceNumber", INTEGER,
            "Cycle", INTEGER,
            {
                {"A", 1, 5},
                {"B", 2, 4},
                {"C", 3, 4},
                {"D", 1, 4},
                {"E", 2, 3},
                {"F", 3, 4},
                {"G", 1, 4},
                {"H", 2, 5},
                {"I", 3, 3}
            }
        )
EVALUATE
SELECTCOLUMNS(
    GENERATE(
        TableB,
        var Cycle_ = TableB[Cycle]
        var SpaceNumber_ = TableB[SpaceNumber]
        var Category_ = TableB[Category]
        var CycleIndexStart = 
            1 + SUMX(
                filter(
                    TableB,
                    TableB[SpaceNumber] = SpaceNumber_
                    &&
                    TableB[Category] < Category_
                ),
                TableB[Cycle]
            )
        var CycleIndex_ =
            GENERATESERIES(
                CycleIndexStart,
                CycleIndexStart + Cycle_ - 1, 1
            )
        return
            CycleIndex_
    ),
    "Category", TableB[Category],
    "SpaceNumber", TableB[SpaceNumber],
    "CycleIndex", [Value]
)

Execute this code in DAX Studio... By the way, your result table from above has mistakes in it. Mine seems to work correctly.

MattAllington
Community Champion
Community Champion

Not DAX, but yes to power query. 
load table B to PQ

add a new column that creates a a list from 1 to the value in number cycle. It would look something like this. 

={1..[NumberCycle]}

this will give a column  containing lists. You should be able to expand this column into new rows. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.