Forum Discussion
Saranya_Tamil
3 years agoFrequent Visitor
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 | |||||||
| Resource | Date | Time | Resource | Date | hours | Output | ||
| A | 01/01/2022 | 7.5 | A | 01/01/2022 | 7.5 | 100 | ||
| A | 02/01/2022 | 7.5 | A | 02/01/2022 | 4 | 53.33333 | ||
| A | 03/01/2022 | 7.5 | A | 03/01/2022 | 3.5 | 46.66667 | ||
| A | 04/01/2022 | 7.5 | A | 04/01/2022 | 7 | 93.33333 | ||
| A | 05/01/2022 | 7.5 | A | 05/01/2022 | 7.5 | 100 | ||
| A | 06/01/2022 | 7.5 | A | 06/01/2022 | 7.5 | 100 | ||
| B | 07/01/2022 | 7.5 | B | 07/01/2022 | 6 | 80 | ||
| B | 08/01/2022 | 7.5 | B | 08/01/2022 | 7.5 | 100 | ||
| B | 09/01/2022 | 7.5 | B | 09/01/2022 | 7.5 | 100 | ||
| B | 10/01/2022 | 7.5 | B | 10/01/2022 | 7.5 | 100 |
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 _outputThanks,
1 Reply
- ArulSuper 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 _outputThanks,