Forum Discussion

UmairKamal's avatar
UmairKamal
Helper I
2 years ago

Measure not display in chart

Dear Users,

 

The measure I have is the total time spent by a person doing a task. and this works fine in a table however, it does not work in any graphs. I understand that this is because the measure is calculated and then recognised as a text. however, I am unable to find a solution to this problem. 

 

The DAX code I have used to calculate the measure is as follows:

 

Total Time Spent =

VAR Total_Hours = SUMX(Table1,HOUR(Table1[Time Spent (hh:mm:ss)]) + DIVIDE(MINUTE(Table1[Time Spent (hh:mm:ss)]),60) + DIVIDE(SECOND(Table1[Time Spent (hh:mm:ss)]),3600))

VAR DaysTotal = DIVIDE(Total_Hours,24)

VAR HoursTotal = (DaysTotal)*24

VAR HoursInt = TRUNC(Total_Hours)

VAR MinutesTotal = (HoursTotal - HoursInt) * 60

VAR MinutesInt = TRUNC(MinutesTotal)

VAR SecondsTotal = ROUND((MinutesTotal - MinutesInt)*60,0)

RETURN

FORMAT(HoursInt,"00")&":"&FORMAT(MinutesInt, "00")&":"&FORMAT(SecondsTotal, "00")&" "

 

Please advise how to solve this issue?

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi UmairKamal ,
    Here some steps that I want to share, you can check them if they suitable for your requirement.
    Here is my test data:

    Using the format function does force a conversion to text formatting.However only digital format displays are accepted on most visual objects. With this in mind, we can use the dynamic format of measure.
    First, ensure that the options in the preview feature are turned on

    Create a measure

     

     

    Measure = HOUR(SELECTEDVALUE('Table'[Time]))*10000+MINUTE(SELECTEDVALUE('Table'[Time]))*100+SECOND(SELECTEDVALUE('Table'[Time]))

     

     

    Ensure that the y-axis diapaly units option is none

     
    Final output

    Best regards,
    Albert He

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

    • UmairKamal's avatar
      UmairKamal
      Helper I

      Anonymous thanks for your reply. I have followed the steps as you mention but I am not getting the results. In fact, this measure is not even visible in the Matrix Visual. 

       

      Total Time 10 = HOUR(SELECTEDVALUE('Report'[Time Spent (hh:mm:ss)]))*10000+MINUTE(SELECTEDVALUE('Report'[Time Spent (hh:mm:ss)]))*100+SECOND(SELECTEDVALUE('Report'[Time Spent (hh:mm:ss)]))