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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Madhu9a
Regular Visitor

I want to generate a series with multiple start and end values

I have a starting data table in DAX 

Task Initial Interval  Repeat Interval  Initial Life  Final Life
Task_1 32620
Task_2 43718

 

 

I want to use generateseries to repeat the task values starting with Initial Interval and then increment by Repeat Interval till its less than or equal to Initial life then start increment by Initial Interval and then increment  by Repeat Interval till Inital life or Final Life which ever comes first. As listed in the table below

Task Initial Interval  Repeat Interval  Initial Life  Final Life  Series Life Iteration Series Explained
Task_1  326203 Life_1 Starts with 3 (Initial Interval)
Task_1  326205 Life_1  3+ 2 (Add Repeat Interval)
Task_1  326206 Life_1 Add Repeat Interval 5 + 2 = 7 is greater than Initial life 6. so take 6
Task_1  326209 Life_2 Starting task_1 with Life_2   6 + 3 = 9  
Task_1  3262011 Life_2 9 + 2 (Repeat Interval) = 11
Task_1  3262012 Life_2 adding (Repeat Interval) 11 + 2= 13  but is greater than 12 (Multiple of 6 Initial Life)  so take 12
Task_1  3262015 Life_3 starting Task_1 with Life_3  12 + 3 = 15
Task_1  3262017 Life_3 15 + 2 (Repeat Interval) = 17
Task_1   3262018 Life_3 17 + 2 = 19 is greater than 18 multiple of 6 Initial life
Task_1   3262020 Life_4 Starting Task_1 with Life_4
18 + 3 = 21 greater than 20. so take 20 End of Task_1 
Task_2  437184 Life_1 Similar process for Task_2
Task_2  437187 Life_1 
Task_2  4371811 Life_2 
Task_2 4371814 Life_2 
Task_2 4371818 Life_3 


We need not create columns Life Iteration and Series Explained. Only Series column is required. How can we create this sort of series. Please help

 

1 ACCEPTED SOLUTION

Hi @Madhu9a 

 

You can try below calculated table / evaluate expression.

 

xifeng_L_0-1717233796531.png

EVALUATE
GENERATE(
    'Tasks',
    DISTINCT(
        SELECTCOLUMNS(
            GENERATESERIES(1,MAX('Tasks'[Final Life])),
            "Series",
                VAR i = [Value]
                VAR LifeItemNbr = ROUNDUP(DIVIDE('Tasks'[Initial Life]-'Tasks'[Initial Interval],'Tasks'[Repeat Interval]),0)+1
                VAR LifeNbr = ROUNDUP(DIVIDE(i,LifeItemNbr),0)
                VAR j = MOD(i-1,LifeItemNbr)
                RETURN
                MIN(
                    MIN(
                        'Tasks'[Initial Life]*(LifeNbr-1)+'Tasks'[Initial Interval]+'Tasks'[Repeat Interval]*j,
                        'Tasks'[Initial Life]*LifeNbr
                    ),
                    'Tasks'[Final Life]
                )
        )
    )
)
ORDER BY 'Tasks'[Task],[Series]

 

 

Demo - I want to generate a series with multiple start and end values.pbix

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

View solution in original post

5 REPLIES 5
xifeng_L
Super User
Super User

@Madhu9a 

 

I can't understand your logic. Can you be more detailed?

Modified Original post with explanation

Hi @Madhu9a 

 

You can try below calculated table / evaluate expression.

 

xifeng_L_0-1717233796531.png

EVALUATE
GENERATE(
    'Tasks',
    DISTINCT(
        SELECTCOLUMNS(
            GENERATESERIES(1,MAX('Tasks'[Final Life])),
            "Series",
                VAR i = [Value]
                VAR LifeItemNbr = ROUNDUP(DIVIDE('Tasks'[Initial Life]-'Tasks'[Initial Interval],'Tasks'[Repeat Interval]),0)+1
                VAR LifeNbr = ROUNDUP(DIVIDE(i,LifeItemNbr),0)
                VAR j = MOD(i-1,LifeItemNbr)
                RETURN
                MIN(
                    MIN(
                        'Tasks'[Initial Life]*(LifeNbr-1)+'Tasks'[Initial Interval]+'Tasks'[Repeat Interval]*j,
                        'Tasks'[Initial Life]*LifeNbr
                    ),
                    'Tasks'[Final Life]
                )
        )
    )
)
ORDER BY 'Tasks'[Task],[Series]

 

 

Demo - I want to generate a series with multiple start and end values.pbix

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

Thank you very much 🙏

BeaBF
Super User
Super User

@Madhu9a Hi! Try with this calculated table:

CalculatedTable =
VAR AllTasks =
    GENERATE (
        Tasks,
        VAR Series =
            GENERATESERIES ( [Initial Life], [Final Life], [Repeat Interval] )
        RETURN
            ADDCOLUMNS (
                Series,
                "Task_Name", Tasks[Task],
                "Initial_Interval", Tasks[Initial Interval],
                "Repeat_Interval", Tasks[Repeat Interval],
                "Iteration_Life", "Life_" & ( ( [Value] - Tasks[Initial Life] ) / Tasks[Initial Interval] + 1 )
            )
    )
RETURN
    AllTasks

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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