Forum Discussion
Anonymous
6 years agoNot applicable
Calculated column returning NaN and infinity
I'm trying to create a calculated column in my dataset using the following formula: PercentHoursRemaining = ('column1'[Hours_Actual]) / ('column2'[hours_budget]) Both columns are of data type...
- 6 years ago
hi Anonymous
First, you should know that:
1. Calculation column/table not support dynamic changed based on filter or slicer, it is static.
2. Measure can be affected by filter/slicer, so you can use it to get dynamic summary result.https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/
Second, You could use DIVIDE Function in your formula as below:
https://docs.microsoft.com/en-us/dax/divide-function-dax
https://docs.microsoft.com/en-us/power-bi/guidance/dax-divide-function-operator
Column=DIVIDE('column1'[Hours_Actual],'column2'[hours_budget],0)and for measure you could use this formula
Measure=DIVIDE(SUM('column1'[Hours_Actual]),SUM('column2'[hours_budget]),0)Regards,
Lin
rockingmark
2 years agoAdvocate I
Cool, Thanks v-lili6-msft. The DIVIDE Function worked a treat!!!!