I have measure working for a KPI = CALCULATE(AVERAGE('Table'[Section]),FILTER('Table','Table[Section]<>0))/5.16 This works as a DAX Measure. So as a measure this gives a return and works and exclud...
If you can't change the connection mode of your data from DirectQuery to Import mode, it's not a wise choice to create a calculate column, because after my test, most of the dax functions don't work in Direct Query connection mode so please check if your connection mode is Direct Query After my test, I was not able to use most of the functions in calculate column in this mode (Power BI doesn't prompt for the information)
like this:( I can't even use the calculate function in calculate column with Direct Query mode )
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
According to your description, you created Measure for Direct Query in connection mode and it worked fine: it calculated the correct result and excluded gaps.
However, when you apply the same syntax to calculate column, it has problems: it doesn't calculate the correct result and reminds about the circular dependency problem.
Let's analyze your problems in turn.
Converting a measure to a calculate column
Generally there are problems when copying measure code directly into a new calculate column: the calculate column may report an error, or the result may not be the same as the measure.
This is due to differences in the settings of measure and calculate column.
The result of the measure calculation depends on the current filtering context: the current filtering conditions, and the filtering caused by the user's actions (using slicers or field filtering) can cause the measure value to change dynamically.
A calculate column is a static value that is added to a table after a field has been calculated, and like a normal column, it is calculated in the row context, i.e. the same calculation is performed for every row.
Calculated columns take up RAM memory even if they are not used in the report, whereas measures do not.
So if you want to achieve the same effect in calculate column as in measure, you need to rewrite the DAX code instead of copying it directly.
Use calculate column in Direct Query connection mode will have limitations
Because Direct Query is directly from the data source to query data in real time , there is no way to see the Table of data ; while calculate column is loaded when the data is calculated row by row and added to the table , the two of them together when there will be a lot of problems :
Most of the aggregation function can not be used, even if it can run normally, the code will have an error alert.
Here are my test results:
Direct Query mode:
The result of calculate column is wrong.
But in import mode, the calculate column no longer has a lot of restrictions, but you can see that the results of C_KPI and M_KPI are different, I modified the code in the calculate column, the results are as shown in “Column”