Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

Convert Integer Measure to HH:MM format

STEP 1STEP 1STE2STE2STEP 3STEP 3PBI -2.JPGPBI-1.JPGHi Guys,

 

I have an interger value column from which I need to convert it to hh:mm format, Below is the example.

 

I have a column with values 9, 10.8,12...etc... Now I am trying to convert these values to hh:mm format by creating a measuer like sum(field)/24. it is dividing the value with 24 but I also need the format type to be hh:mm.

 

For example if I have a value of 310, 137.18 I have created a measuer xyz = sum(310, 137.18)/24 = 12,922.38 now I want to convert this 12,922.98 into hh:mm.

 

In excel I have done the same and righ clicked on the cell and choose format --> Number--> custom --> [h]:mm I get 310137:10.

 

I am strugllng to do the same in power bi as the data type function in modelling is disabled,If I highlight the measuer and click on the modeling the data type is not enabled.

 

 Please find the screenshots below.Any suggestions please help, Let me know if needed any details Thanks

 

 

 

1 REPLY 1
v-xjiin-msft
Solution Sage
Solution Sage

Hi @Anonymous,

 

Yes, there's no such custom SUM Hours format like Excel in Power BI. So to achiveve your requirement, we need to do some workarounds by using Power Query.

 

As in your scenario, we need to do the format first and then create a measure xyz to calculate the SUM. For the format, you can refer to following method:

 

Go to Edit Queries, add a custom column with Duration.TotalHours function which will return the total hours.

 

= Duration.TotalHours(Duration.From([Column1]))

1.PNG

 

After doing these format, then you can go back to Data Model and create the xyz measure to get the total SUM Hours.

 

Then for the last part as converting the number to HH:MM format. I'm afraid it cannot be achieved since there's no such corresponding format, and we are doing something like converting a number from SUM measure to Text. 

 

Thanks,
Xi Jin.

 

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors