Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Insert Calculated row as new item under existing variable

Hi, 

I am new to DAX query, could you please help me to know how to create an calculated new item under existing variable.

 

So i neeed the Combination of Items(0.5L and RW) under brand variable fro Budweiser, all highlighted in yellow. Any help would be much appreciated

  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous,

    Change your DAX to the following:

    NewTable=UNION(Table,ROW("Brand", "BUD_0.5L_RW",  
             "Vol", "","Type","","Month","","Sales",CALCULATE(SUM(Table[Sales]),FILTER(Table,Table[Brand]="BUDWEISER"&&Table[Vol]="0.5 L"&&Table[Type]="RW")  )))



    Regards,
    Lydia

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous,

    Create new table using DAX below.

    Table = UNION(YourTable,ROW("Brand", "BUD_0.5L_RW",  
             "Vol", "","Type","","Month","","Sales",302984)  )



    Regards,
    Lydia

    • Anonymous's avatar
      Anonymous
      Not applicable

      BUD_0.5L_RW should be calcualted row/dynamic not fixed. I see that the total sales is fixed here to create new table. It should auto calculate 302984 using condition brand IN BUD,Volume IN 0.5L and Type In RW.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous,

        Change your DAX to the following:

        NewTable=UNION(Table,ROW("Brand", "BUD_0.5L_RW",  
                 "Vol", "","Type","","Month","","Sales",CALCULATE(SUM(Table[Sales]),FILTER(Table,Table[Brand]="BUDWEISER"&&Table[Vol]="0.5 L"&&Table[Type]="RW")  )))



        Regards,
        Lydia