Forum Discussion

Saranya_Tamil's avatar
Saranya_Tamil
Frequent Visitor
3 years ago
Solved

Need help in DAX

Hi,
I have 2 tables. Table A shows the number of hours eligible to work and Table B shows how many hours they actually worked. I need to calculate Time% i.e.  (hours/Time)*100 for each resource for everyday as output. I have many resources in the table.  Can anyone help to achieve this in DAX. I have highlighted the expected output column.

 

Table A    Table B   
ResourceDateTime  ResourceDatehoursOutput
A01/01/20227.5  A01/01/20227.5100
A02/01/20227.5  A02/01/2022453.33333
A03/01/20227.5  A03/01/20223.546.66667
A04/01/20227.5  A04/01/2022793.33333
A05/01/20227.5  A05/01/20227.5100
A06/01/20227.5  A06/01/20227.5100
B07/01/20227.5  B07/01/2022680
B08/01/20227.5  B08/01/20227.5100
B09/01/20227.5  B09/01/20227.5100
B10/01/20227.5  B10/01/20227.5100
  • Hi Saranya_Tamil ,

    You can try the below formula in calculated column,

     

     

    Output Column = 
    VAR _lookupvalue = LOOKUPVALUE('Table A'[Time],'Table A'[Resource],'Table B'[Resource])
    VAR _output = DIVIDE('Table B'[hours],_lookupvalue,0)*100
    RETURN _output

     

     

    Thanks,

     

1 Reply

  • Arul's avatar
    Arul
    Super User

    Hi Saranya_Tamil ,

    You can try the below formula in calculated column,

     

     

    Output Column = 
    VAR _lookupvalue = LOOKUPVALUE('Table A'[Time],'Table A'[Resource],'Table B'[Resource])
    VAR _output = DIVIDE('Table B'[hours],_lookupvalue,0)*100
    RETURN _output

     

     

    Thanks,