Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Divide and Lookup

Hello Everyone,

 

I have 2 tables :

 

IDLocationTracking
11USA10
22Malaysia3
33India4
44Germany5
55India4
66Singapore1
77USA2
11India6
11China5
11Japan4
22Malaysia9
22Japan1

 

 

IDFinal Tracking
119
224
339
446
5510
6610
778

 

 

I wanted to create a measure where I need to divide Tracking by Final Tracking, but I need to add the duplicates on the first table.

 

Sample : ID 11 have 4 entries with a total of 25 trackings. so (25/9)-1 = 1.77

Thanks!



  • Hi Anonymous 

    1. Place Table2[ID] in a table visual

    2. Create this measure and palce it in the visual

    Measure =
    DIVIDE (
        SUM ( Table2[Tracking] ),
        CALCULATE (
            SUM ( Table1[Tracking] ),
            TREATAS ( DISTINCT ( Table2[ID] ), Table1[ID] )
        )
    ) - 1
    

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    You can create a measure as below:

    Measure = 
    VAR _tracking =
        CALCULATE (
            SUM ( 'Tracking'[Tracking] ),
            FILTER ( 'Tracking', 'Tracking'[ID] = MAX ( 'Final Tracking'[ID] ) )
        )
    VAR _finaltraking =
        SUM ( 'Final Tracking'[Final Tracking] )
    RETURN
        DIVIDE ( _tracking, _finaltraking, 0 ) - 1

    Best Regards

2 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous 

    1. Place Table2[ID] in a table visual

    2. Create this measure and palce it in the visual

    Measure =
    DIVIDE (
        SUM ( Table2[Tracking] ),
        CALCULATE (
            SUM ( Table1[Tracking] ),
            TREATAS ( DISTINCT ( Table2[ID] ), Table1[ID] )
        )
    ) - 1
    

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    You can create a measure as below:

    Measure = 
    VAR _tracking =
        CALCULATE (
            SUM ( 'Tracking'[Tracking] ),
            FILTER ( 'Tracking', 'Tracking'[ID] = MAX ( 'Final Tracking'[ID] ) )
        )
    VAR _finaltraking =
        SUM ( 'Final Tracking'[Final Tracking] )
    RETURN
        DIVIDE ( _tracking, _finaltraking, 0 ) - 1

    Best Regards