Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Divide Measure by its Max value

I have two tables. They are related to each other on ID.

 

I want to calculate -

Final Speed which is = Speed Measure/max (Speed Measure)

 

But I am unable to do so. It is not recognising it as a measure. How should I do this? Is there any different way? Pls, let me know. Thanks in Advance!

 

These I calculated-

Measure in Table 2 →Speed Measure = sum('Table2'[Quantity])/Sum('Table1’'[Time])

 

Calculated Column in Table 1→ Time = (DATEDIFF('Table1’[Start Time], 'Table2’'[End Time],SECOND))

 

  • Hi Anonymous ,

     

    How about this:

    ID 11 has the maximum speed, which is why the measure shows 1.

     

    This is the measure I used:

    Speed 1 mes = 
    VAR _helpTable  = 
                SUMMARIZE (
                    ALLSELECTED ( Table2 ),
                    [ID],
                    "speed", [speed1]
                )
    VAR _maxSpeed = CALCULATE ( MAXX ( _helpTable , [speed] ) )
    RETURN
     DIVIDE ( Table2[Speed1], _maxSpeed )

     

    Hope this is it!

    /Tom

    https://www.tackytech.blog

    https://www.instagram.com/tackytechtom

     

     

9 Replies

  • tackytechtom's avatar
    tackytechtom
    Most Valuable Professional

    Hi Anonymous ,

     

    I am not entirely sure whether this one here works for you, but it might be worth a try 🙂 

    Measure = 
    VAR _helpTable  = SUMMARIZE ( 'Table', 'Table'[ID], "speed", Table[Speed Measure] )
    VAR _maxSpeed = MAXX ( _helpTable , [speed] ) 
    RETURN
    DIVIDE ( CALCULATE(Table[Table[Speed Measure]] ), _maxSpeed )

     

    /Tom

    https://www.tackytech.blog

    https://www.instagram.com/tackytechtom

  • Anonymous's avatar
    Anonymous
    Not applicable

    tackytechtomThanks for helping. It is giving 1 as an answer for all rows. It is not giving correct output.

      • Anonymous's avatar
        Anonymous
        Not applicable

        tackytechtom Thanks for answering. I am sharing the details.

         

        Time = (DATEDIFF('Table1'[start time], 'Table1'[end time],SECOND))
        Speed1 = SUM(Table2[Volume])/sum(Table1[Time])
        Speed 1 col = DIVIDE(Table2[Volume], SUM(Table1[Time]))
        These are two tables linked with each other on ID.If I divide columns as measure, it gives correct answer. But when I divide it as calculated column, answer is not correct.
         
        I just wanted to divide the speed with max speed. Thanks in advance!