Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to recode revenue from reporting code ?

 

  • Hi, Anonymous 

    According to your picture, I can’t determine which column you want to recode, so I write DAX for both column, you can take a look:

    For [C/D]:

    C/D1 =
    
    IF(
    
        [Reporting Code]>=6&&[Reporting Code]<=10,
    
        "Revenue",
    
    CONVERT([C/D],STRING))

    This is the result:

     

    For Reporting Code1:

    Reporting Code1 =
    
    IF(
    
        [Reporting Code]>=6&&[Reporting Code]<=10,
    
        "Revenue",
    
        CONVERT([Reporting Code],STRING))

    This is the result:

     

    And you can choose the expected result from one of these

    You can download my test pbix file here

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

     

    Best Regards,

    Community Support Team _Robert Qin

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

3 Replies

  • mohammedadnant's avatar
    mohammedadnant
    Impactful Individual

    Hi Anonymous 

     

    Good day,

     

    Create a new manual table 1=a value, 2=b value likt this 6=Revenue, 7=Revenue etc.. and make relationship with this table, hope this will help you to get the desired result.

     

    Thanks & Regards,

    Mohammed Adnan

    www.youtube.com/taik18

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Moha

      Thank you for your sharing by using PQ.

      But In my actual application  , i have runnning number , for example :-

      1 till 99 = revenue

      99 till 200 = expense 

      So i need to use DAX script.

       

      Paul Yeo

       

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

    Hi, Anonymous 

    According to your picture, I can’t determine which column you want to recode, so I write DAX for both column, you can take a look:

    For [C/D]:

    C/D1 =
    
    IF(
    
        [Reporting Code]>=6&&[Reporting Code]<=10,
    
        "Revenue",
    
    CONVERT([C/D],STRING))

    This is the result:

     

    For Reporting Code1:

    Reporting Code1 =
    
    IF(
    
        [Reporting Code]>=6&&[Reporting Code]<=10,
    
        "Revenue",
    
        CONVERT([Reporting Code],STRING))

    This is the result:

     

    And you can choose the expected result from one of these

    You can download my test pbix file here

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

     

    Best Regards,

    Community Support Team _Robert Qin

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