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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Generate series of numbers based on other table values

Hi All,

 

I am having a data like below,

LabelStartEnd
Car13
Bike15

 

My expected result should be,

LabelValue
Car1
Car2
Car3
Bike1
Bike2
Bike3
Bike4
Bike5

 

Could anybody help me to get the expected table?

 

Thanks,

Deepak

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hello @deepaknarayank

you can use this simple formula to create a new table

New table =
SELECTCOLUMNS (
    FILTER (
        GENERATE (
            'Table',
            GENERATESERIES ( MIN ( 'Table'[Start] ), MAX ( 'Table'[End] ), 1 )
        ),
        [Value] >= [Start]
            && [Value] <= [End]
    ),
    "Label", [Label],
    "Value", [Value]
)

result:

3.JPG

and here is the sample pbix file, please try it.

Best regards

Lin

Community Support Team _ Lin
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

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hello @deepaknarayank

you can use this simple formula to create a new table

New table =
SELECTCOLUMNS (
    FILTER (
        GENERATE (
            'Table',
            GENERATESERIES ( MIN ( 'Table'[Start] ), MAX ( 'Table'[End] ), 1 )
        ),
        [Value] >= [Start]
            && [Value] <= [End]
    ),
    "Label", [Label],
    "Value", [Value]
)

result:

3.JPG

and here is the sample pbix file, please try it.

Best regards

Lin

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

Hi Lin,

 

Thank you so much for your solution..

 

This works fine..

 

Thanks & regards,

Deepak

 

FrankAT
Community Champion
Community Champion

Hi,

open Power Query and follow these steps:

// Table
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wck4sUtJRMgRiY6VYnWglp8zsVKiAqVJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Label = _t, Start = _t, End = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Label", type text}, {"Start", Int64.Type}, {"End", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Series", each {[Start]..[End]}),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Label", "Series"}),
    #"Expanded Series" = Table.ExpandListColumn(#"Removed Other Columns", "Series")
in
    #"Expanded Series"

 

11-03-_2020_11-14-05.png

 

Regards FrankAT

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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