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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Time Measure sum Time Measure error

Hi Guys,

 

I'm trying to sum the three below measures together, which forum member Icey kindly help with,  but an recieving the following error.

 

Couldnt load the data for the visual - Calculation error cannot convert value of Type text to type number

 

MY measure which i am recieivng the error from is

Total activity new measure = CALCULATE('Calls SQL'[Total call time new mesaure] + 'Calls SQL'[Total wrap time new measure] + Breaks[Total make busy time new measure])
 
Measure 1
Total call time new mesaure = VAR Seconds1 = SUMX ( 'Calls SQL', SECOND ( 'Calls SQL'[Total Time on Calls] ) ) VAR Minutes1 = SUMX ( 'Calls SQL', MINUTE ( 'Calls SQL'[Total Time on Calls] ) ) VAR Hours1 = SUMX ( 'Calls SQL', HOUR ( 'Calls SQL'[Total Time on Calls] ) ) VAR Seconds2 = MOD ( Seconds1, 60 ) VAR Minutes2 = MOD ( TRUNC ( Seconds1 / 60 ) + Minutes1, 60 ) VAR Hours2 = Hours1 + TRUNC ( ( TRUNC ( Seconds1 / 60 ) + Minutes1 ) / 60 ) RETURN Hours2 & ":" & FORMAT ( Minutes2, "00" ) & ":" & FORMAT ( Seconds2, "00" )
 
Measure 2
Total wrap time new measure = VAR Seconds1 = SUMX ( 'Calls SQL', SECOND ( 'Calls SQL'[Wrap Time] ) ) VAR Minutes1 = SUMX ( 'Calls SQL', MINUTE ( 'Calls SQL'[Wrap Time] ) ) VAR Hours1 = SUMX ( 'Calls SQL', HOUR ( 'Calls SQL'[Wrap Time] ) ) VAR Seconds2 = MOD ( Seconds1, 60 ) VAR Minutes2 = MOD ( TRUNC ( Seconds1 / 60 ) + Minutes1, 60 ) VAR Hours2 = Hours1 + TRUNC ( ( TRUNC ( Seconds1 / 60 ) + Minutes1 ) / 60 ) RETURN Hours2 & ":" & FORMAT ( Minutes2, "00" ) & ":" & FORMAT ( Seconds2, "00" )
 
Measure 3
Total make busy time new measure = VAR Seconds1 = SUMX ( 'Breaks', SECOND ( 'Breaks'[Minutes] ) ) VAR Minutes1 = SUMX ( 'Breaks', MINUTE ( 'Breaks'[Minutes] ) ) VAR Hours1 = SUMX ( 'Breaks', HOUR ( 'Breaks'[Minutes] ) ) VAR Seconds2 = MOD ( Seconds1, 60 ) VAR Minutes2 = MOD ( TRUNC ( Seconds1 / 60 ) + Minutes1, 60 ) VAR Hours2 = Hours1 + TRUNC ( ( TRUNC ( Seconds1 / 60 ) + Minutes1 ) / 60 ) RETURN Hours2 & ":" & FORMAT ( Minutes2, "00" ) & ":" & FORMAT ( Seconds2, "00" )
 
1 ACCEPTED SOLUTION

Hi @Anonymous,

I found a typo on my formula in 'tsBK' variable('Calls SQL' should be 'Breaks' and I already modify on above post), you can modify measure formula to confirm if the wrong calculation is caused with this part.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

Current DAX formulas do not support to use math operator on text values.
According to your DAX formulas, they will return merges text values that not able to do math calculation, you can only use text operation functions and logic operators to compare with different text values.

DAX operators 

Please keep your duration as a numeric value(total second) and convert them after calculations instead convert before calculations.

Aggregating Duration Time 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Ok that makes sense thanks for that, could you help with the formula??

HI @Anonymous ,

You can try to use the following measure formula:

 

Total time =
VAR tsCS =
    SUMX (
        'Calls SQL',
        VAR _t1 =
            TIMEVALUE ( 'Calls SQL'[Total Time on Calls] )
        VAR _t2 =
            TIMEVALUE ( 'Calls SQL'[Wrap Time] )
        RETURN
            ( HOUR ( _t1 ) + HOUR ( _t2 ) ) * 3600
                + ( MINUTE ( _t1 ) + MINUTE ( _t2 ) ) * 60
                + SECOND ( _t1 )
                + SECOND ( _t2 )
    )
VAR tsBK =
    SUMX (
        'Breaks',
        VAR _t1 =
            TIMEVALUE ( 'Breaks'[Minutes] )
        RETURN
            HOUR ( _t1 ) * 3600
                + MINUTE ( _t1 ) * 60
                + SECOND ( _t1 )
    )
VAR ts = tsCS + tsBK
VAR _hour =
    INT ( ts / 3600 )
VAR _minute =
    INT ( MOD ( ts, 3600 ) / 60 )
VAR _second = ts - _hour * 3600 - _minute * 60
RETURN
    _hour & ":"
        & FORMAT ( _minute, "00" ) & ":"
        & FORMAT ( _second, "00" )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Thanks for this @v-shex-msft .  I seem to be getting different results to what excel would show as a total. 

 

Excel = 48:47:31

Power BI Measure = 499:47:08

 

forum.JPG

Hi @Anonymous,

I found a typo on my formula in 'tsBK' variable('Calls SQL' should be 'Breaks' and I already modify on above post), you can modify measure formula to confirm if the wrong calculation is caused with this part.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Amazing amazing amazing thanks very much 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.