Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

PowerBI DAX

New to PowerBI, please help. 

I am trying to substract the min value of the column (Start) to the max value of the column (Finish) to get hours worked. However, I need it to be individually filtered by name otherwise I get the same answer? Thank you 

 

 

  • measure := CALCULATE(MAX('Table'[finish]),ALLEXCEPT('Table','Table'[name]))-CALCULATE(MAX('Table'[start]),ALLEXCEPT('Table','Table'[name]))

    Anonymous 

  • Anonymous 

    CALCULATE(MIN(Start),All(Table name))- CALCULATE(MAX(end),All(Table name)) (Create a new measure) will give the result as you reqruire. Let me know whether this is helpful

  • smpa01's avatar
    smpa01
    5 years ago

    Anonymouscan you try

    ALLEXCEPT('Table','Table'[date], 'Table'[name]))

6 Replies

  • smpa01's avatar
    smpa01
    Community Champion
    measure := CALCULATE(MAX('Table'[finish]),ALLEXCEPT('Table','Table'[name]))-CALCULATE(MAX('Table'[start]),ALLEXCEPT('Table','Table'[name]))

    Anonymous 

    • Anonymous's avatar
      Anonymous
      Not applicable

      smpa01 that worked, thank you! However, I forgot to mention the dates column, the report comes out every day so I need to calculate min and max of the columns by date and name. Is there an easy way to add this to your formula please? 

       

      measure := CALCULATE(MAX('Table'[finish]),ALLEXCEPT('Table','Table'[name]))-CALCULATE(MAX('Table'[start]),ALLEXCEPT('Table','Table'[name]))

       

      Thank you very much  

      • smpa01's avatar
        smpa01
        Community Champion

        Anonymouscan you try

        ALLEXCEPT('Table','Table'[date], 'Table'[name]))
  • VijayP's avatar
    VijayP
    Community Champion

    Anonymous 

    CALCULATE(MIN(Start),All(Table name))- CALCULATE(MAX(end),All(Table name)) (Create a new measure) will give the result as you reqruire. Let me know whether this is helpful