Forum Discussion

HenryJS's avatar
HenryJS
Post Prodigy
6 years ago
Solved

Add New Column: % calculated from columns

Hi all,

 

How do I add a new column which is a calculation of two columns below to create a %?

 

i.e. open jobs/advertised open jobs *100 = %

 

The first row would be 90%

 

Open Jobs column is a count of a text column.

 

Advertised Open Jobs column is a sum of a conditional column.

 

 

 

Thanks,

 

Henry

  • Not sure, I got the problem

    New column = divide([Advertised Open Job],[Open Job])*100

     

     

    New Measure= divide(sum([Advertised Open Job]),sum([Open Job]))*100

     

    Edited**

5 Replies

  • kentyler's avatar
    kentyler
    Solution Sage

    You don't say whether [Open Jobs] and [Advertised Open Jobs] are calculated columns or measures.

    If they are measures you could write something like

    Percent Open Jobs = DIVIDE([Open Jobs]/[Advertised Open Jobs]) * 100

    The DIVIDE will protect against division by zero

     

    I'm a personal Power Bi Trainer I learn something every time I answer a question

    The Golden Rules for Power BI

    1. Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. https://www.youtube.com/watch?v=FxiAYGbCfAQ
    2. Build your data model as a Star Schema. Creating a star schema in Power BI is the best practice to improve performance and more importantly, to ensure accurate results! https://www.youtube.com/watch?v=1Kilya6aUQw
    3. Use a small set up sample data when developing. When building your measures and calculated columns always use a small amount of sample data so that it will be easier to confirm that you are getting the right numbers.
    4. Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result  to check on your steps along the way.
    • HenryJS's avatar
      HenryJS
      Post Prodigy

      Hi kentyler ,

       

      Advertised open jobs is a new conditional column. So it is a calculated column.

       

      Open Jobs is just from the raw data and summarised by a count.

       

      Thanks,

       

      Henry

  • Not sure, I got the problem

    New column = divide([Advertised Open Job],[Open Job])*100

     

     

    New Measure= divide(sum([Advertised Open Job]),sum([Open Job]))*100

     

    Edited**

    • HenryJS's avatar
      HenryJS
      Post Prodigy

      Hi amitchandak 

       

      Both 'job ref as 1' and  'HasAdvert as 1' are calculated columns.

       

      I input the below formula but too few arguments were passed to the divide function?