Forum Discussion

seankeatingpb's avatar
seankeatingpb
Regular Visitor
1 month ago
Solved

Calculate new column based on another column's text

Hi.

 

Really banging my head over this one; all I need is to have a new column called Hours based on a division of the Minutes Column below, but I only want it to calculate if Category A.

 

i.e.  If Category is A below, then divide the Minutes column by 60 to get Hours (decimal). Otherwise leave blank.

 

CategoryMinutesHours
A2003.3
B90 
C180 
D150 
E240 
F210 
G35 

 

Once I have the results then I plan to create an average measure which I can do via a Table visual. 

 

Thanks in advance.

 

 

  • Hi seankeatingpb , create a calculated column with this code (let's call it Hours and let's suppose your table in named CategoryMinutes)

     

    IF ( 
              CategoryMinutes[Category] = "A",
              DIVIDE( CategoryMinutes[Minutes], 60 )
    )

     

    This will automatically leave a blank when category is different than A

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI

1 Reply

  • Hi seankeatingpb , create a calculated column with this code (let's call it Hours and let's suppose your table in named CategoryMinutes)

     

    IF ( 
              CategoryMinutes[Category] = "A",
              DIVIDE( CategoryMinutes[Minutes], 60 )
    )

     

    This will automatically leave a blank when category is different than A

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI