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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
galavichid
Regular Visitor

Calculate percentage from time value calculated by another 'measure'

Hi All,

 

I am trying to create calculation of a value I get with the measure:

 

 

 

 

 

GAL = 
VAR Total_Hours =
    SUMX(
        'GAL',
        HOUR('GAL'[TotalTime]) + DIVIDE(MINUTE('GAL'[TotalTime]),60) + DIVIDE(SECOND('GAL'[TotalTime]),3600)
    )
VAR DaysTotal = DIVIDE(Total_Hours,24)
VAR HoursTotal = (DaysTotal)*24
VAR HoursInt = TRUNC(HoursTotal)
VAR MinutesTotal = (HoursTotal - HoursInt)*60
VAR MinutesInt = TRUNC(MinutesTotal)
VAR SecondsTotal = ROUND((MinutesTotal - MinutesInt)*60,0)
RETURN
    FORMAT(HoursInt,"00")&"h, "&FORMAT(MinutesInt,"00")&"m, "&FORMAT(SecondsTotal,"00")&"s "

 

 

With this measure will present me the amount of hours calculate from the column 'TotalTime'. It will be presented like this: 

87h, 22m, 22s

 

I would like to take the 'hours' and calculate how much percentage it will be out of 192 for example.

 

I have tried to use this:

Percentage = DIVIDE(ExistingMeasureValue, TotalMeasureValue, 0) * 100

But i get an error it can't use the hours value to calculate.

 

Any other suggestion ?

1 ACCEPTED SOLUTION
bsheffer
Continued Contributor
Continued Contributor

your GAL measure has a variable for hours: 

Total_Hours

if you created a new measure that filled that variable the same way and another variable that had your total_value (192) then you could just return

divide(total_hours, total_value) and format the measure as a percentage

View solution in original post

6 REPLIES 6
bsheffer
Continued Contributor
Continued Contributor

please show the actual measure or variable names you are using to calculate

 

Percentage = DIVIDE(ExistingMeasureValue, TotalMeasureValue, 0) * 100

 

 

I use this to get the total amount of hours from Excel file:

GAL = 
VAR Total_Hours =
    SUMX(
        'GAL',
        HOUR('GAL'[TotalTime]) + DIVIDE(MINUTE('GAL'[TotalTime]),60) + DIVIDE(SECOND('GAL'[TotalTime]),3600)
    )
VAR DaysTotal = DIVIDE(Total_Hours,24)
VAR HoursTotal = (DaysTotal)*24
VAR HoursInt = TRUNC(HoursTotal)
VAR MinutesTotal = (HoursTotal - HoursInt)*60
VAR MinutesInt = TRUNC(MinutesTotal)
VAR SecondsTotal = ROUND((MinutesTotal - MinutesInt)*60,0)
RETURN
    FORMAT(HoursInt,"00")&"h, "&FORMAT(MinutesInt,"00")&"m, "&FORMAT(SecondsTotal,"00")&"s "

 

bsheffer
Continued Contributor
Continued Contributor

no, I wanted to see the values or measures you wanted to plug into 

Percentage = DIVIDE(ExistingMeasureValue, TotalMeasureValue, 0) * 100  based on your GAL measure

 

galavichid_0-1677707222509.png

galavichid_1-1677707248868.png

The vaules from the TotalTime colmun, are calculated by the measure above.

Its the only measure i have, I thought to use this measure, and do the calculation from the value i get from it. 

Could be i am not in the right direction at all, i am very new to Power BI.

 

Thanks

 

bsheffer
Continued Contributor
Continued Contributor

your GAL measure has a variable for hours: 

Total_Hours

if you created a new measure that filled that variable the same way and another variable that had your total_value (192) then you could just return

divide(total_hours, total_value) and format the measure as a percentage

Thanks so much

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.