Forum Discussion

ItSupportElm's avatar
ItSupportElm
Helper III
6 years ago
Solved

Distinct Id in direct query

Hello,

 

I want to have distinct ID in my column but i dont know how to do it im in direct query :

and i want to have something like that : 

 

 

Thanks for the futur answer.

 

 

 

  • Hi,

     

    You can try this calculated column:

    Column = IF('Test-1'[Nom]<>"C",BLANK(),'Test-1'[ID])

    The result shows:

    Hope this helps.

     

    Best Regards,

    Giotto Zhi

     

4 Replies

  • az38's avatar
    az38
    Community Champion

    Hi ItSupportElm 

    what result do you expect if you have the only row like 

    11111 RetourSousGarantie ?

     

  • Hi! pay attention to your chart. If you have two columns it will try to find distinct for both of them. That's why you see the Id two times, because it contains two "Nom" for each id. If you just want the id to be unique you have to aggregate the "Nom" column in order to let the table understand that you want just one value for id and an aggregation for nom. 

    I guess Nom is a text, so you have to play with last or first.

     

    If you see your table values you can click on the small arrow and pick the aggregations you want. You should have Don't summarize by default:

    text aggregate

     

    Pick one of them depending your requirement.

     

    Regards,

     

    • ItSupportElm's avatar
      ItSupportElm
      Helper III

      ibarrau Thanks for your answer, but there is not an other way to do what i want ? a different visualisation or a dax formul ?

       

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Community Support

    Hi,

     

    You can try this calculated column:

    Column = IF('Test-1'[Nom]<>"C",BLANK(),'Test-1'[ID])

    The result shows:

    Hope this helps.

     

    Best Regards,

    Giotto Zhi