powerbidaxpowerbi-desktop

The PeriodCustomer column is not found or cannot be used in this expression. Power BI (DAX)


I am writing code to determine the Running Total Customers: All Customers Until This Period. Now, I have created a This period's Customers table to contain the following code:

PeriodeKlant = DISTINCTCOUNT(Text[PCHN])

I have now created the code as below:

Running Total Customers = 
var _currdate=MAX(Tekst[Datum].[Date])
var _salesthisperiod=Tekst[Verkoopdoc]
return
if(_salesthisperiod>0,
    CALCULATE(
        [PeriodeKlant], 
        FILTER(
            ALLSELECTED(Tekst[Datum].[Date]),
            ISONORAFTER(Tekst[Datum].[Date], _currdate, DESC)
        )
    )
)

enter image description here

I get the message that the previously created column cannot be used, this column has the value integer and at summary it says sum. I don't know if that is why I would not be able to load this data?

But because of this error I can't run my measure.


Solution

  • The way your DAX is written, it's expecting [PeriodeKlant] to be a measure rather than a calculated column. Try deleting this calculating this column and defining it as a measure instead.