Search code examples
excelpowerbidax

dax formula to calculate a key


I have an Excel file which contains the following columns (Position, Center, Date, ARTICLE, DES_ARTICLE, quantity_produced, opening_time (TPS_OUV)) and this photo represents a cross table of the sums of opening times of articles in gias6 center and conila machines, we have a key which is equal to the total of an article on general total, how I can do it in powerbi from file excel example: key = 50.24998/1404.9669

enter image description here

Total Operating Time: = SUM(Table1[TPS_OUV])
Key: = DIVIDE([Total for Article], [Total Operating Time])
Total for Article: = CALCULATE([Total Operating Time], ALLEXCEPT(Table1, Table1[ARTICLE]))

all keys=100% so I think I have an error in my code


Solution

  • you can try this

    Measure =
    DIVIDE (
        SUM ( 'Table'[TPS_OUV] ),
        CALCULATE (
            SUM ( 'Table'[TPS_OUV] ),
            ALLEXCEPT ( 'Table', 'Table'[Centre], 'Table'[Position] )
        )
    )
    

    enter image description here