Forum Discussion

DataHero's avatar
DataHero
Icon for Helper I rankHelper I
1 year ago
Solved

GENERATESERIES by boundaries

Hi forum,   I have a question to you regarding following scenario:  Table Dim_SKR4_Account_Group contains financial account groups, defined by ranges. Dim_SKR4_Chart_of_Accounts contain...
  • DataHero's avatar
    1 year ago

    Hi forum,

    I found a solution now for my specific case:

    Mapp_Populated_Account_Series =

    GENERATE (

        SELECTCOLUMNS (

            'Dim_SKR4_Account_Group',

            "Account lower boundary", Dim_SKR4_Account_Group[KontoNrUntergrenze],

            "Account upper boundary", Dim_SKR4_Account_Group[KontoNrObergrenze]

        ),

        GENERATESERIES (

            [Account lower boundary],

            [Account upper boundary],

            1

        )

    )

     


    When you use GENERATESERIES, attention is to be paid in case you want to rename columns withing this code. DAX can easily loose the context here.
    To avoid errors, the code is to be written as for the column “test” in case of renaming.

     

    Mapp_Populated_Account_Series =

    GENERATE (

        SELECTCOLUMNS (

            'Dim_SKR4_Account_Group',

            "test", Dim_SKR4_Account_Group[KontoNrUntergrenze],

           [KontoNrObergrenze]

        ),

        GENERATESERIES (

            [test],

            'Dim_SKR4_Account_Group'[KontoNrObergrenze],

            1

        )

    )

     

    )

     

    To avoid problems, I recommend to rename already in PQ.