Forum Discussion

cosminc's avatar
cosminc
Icon for Post Partisan rankPost Partisan
7 years ago

3 columns from 1 column with 3 dimensions on M Language - Query Editor - previous row value

Hi all,

i need to manipulate on Query Editor (M Language) a base which have 3 dimensions on a column and i have to obtain 3 columns - Category, Subcategory & Items

Note: As a logical step - Category items have always null on the next row from right columns while Subcategory items have values on next row

 

Source:

    
Category A   
subcategory 1   
dasda183721.2100
sdfsd231126.7100
fsds189121.8100
fsdfs168719.5100
fsdfs6337.3100
    
subcategory 2   
fsdfs415748100
fsdfds227826.3100
fdss192522.2100
    
Category B   
subcategory 1   
fsdfsf6507.5100
fsfs99511.5100
fsds91710.6100
fsdfsf99511.5100
fsdfsf123414.3100

 

 

expected results:

 

Category Asubcategory 1dasda183721.2100
Category Asubcategory 1sdfsd231126.7100
Category Asubcategory 1fsds189121.8100
Category Asubcategory 1fsdfs168719.5100
Category Asubcategory 1fsdfs6337.3100
Category Asubcategory 2fsdfs415748100
Category Asubcategory 2fsdfds227826.3100
Category Asubcategory 2fdss192522.2100
Category Bsubcategory 1fsdfsf6507.5100
Category Bsubcategory 1fsfs99511.5100
Category Bsubcategory 1fsds91710.6100
Category Bsubcategory 1fsdfsf99511.5100
Category Bsubcategory 1fsdfsf123414.3100

 

Can you help me with this issue

Thanks,

Cosmin

2 Replies

  • vivran22's avatar
    vivran22
    Icon for Community Champion rankCommunity Champion

    cosminc 

     

    Hi,

     

    Please find the pbix file here

     

    There could be other possible ways, but this is what I have come up with and it should solve the purpose.

     

    Rgds,

    Vivek

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • cosminc's avatar
      cosminc
      Icon for Post Partisan rankPost Partisan

      Hi,

      on the  real base the names are different and not connected with the scope, i put that names for a better understanding

      i say you used them on conditional columns

      the construction have to be something with if below ros is null then column otherwise null

      Thanks,

      Cosmin