Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have a invoice table: fact_BillingInvoice (ID_Customer, ID_BillingInvoice, InvoiceDate). A customer is considerd active if it has a purchase within the last year from a given date.
I've tried this messure but i get error: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
Solved! Go to Solution.
Hi @eaj ,
DATEADD returns a table containing a column of date values. Here you need to return a scalar value.
Please try this:
Active customers =
VAR one_year_back =
EDATE ( Dim_Date[Date], -12 )
RETURN
CALCULATE (
DISTINCTCOUNT ( Fact_BillingInvoice[ID_Customer] ),
FILTER (
ALL ( Fact_BillingInvoice ),
Fact_BillingInvoice[InvoiceDate] >= one_year_back
&& Fact_BillingInvoice[InvoiceDate] <= TODAY ()
)
)
Or(a measure):
Active customers =
VAR one_year_back =
EDATE ( MAX(Dim_Date[Date]), -12 )
RETURN
CALCULATE (
DISTINCTCOUNT ( Fact_BillingInvoice[ID_Customer] ),
Fact_BillingInvoice[InvoiceDate] >= one_year_back,
Fact_BillingInvoice[InvoiceDate] <= TODAY ()
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @eaj ,
DATEADD returns a table containing a column of date values. Here you need to return a scalar value.
Please try this:
Active customers =
VAR one_year_back =
EDATE ( Dim_Date[Date], -12 )
RETURN
CALCULATE (
DISTINCTCOUNT ( Fact_BillingInvoice[ID_Customer] ),
FILTER (
ALL ( Fact_BillingInvoice ),
Fact_BillingInvoice[InvoiceDate] >= one_year_back
&& Fact_BillingInvoice[InvoiceDate] <= TODAY ()
)
)
Or(a measure):
Active customers =
VAR one_year_back =
EDATE ( MAX(Dim_Date[Date]), -12 )
RETURN
CALCULATE (
DISTINCTCOUNT ( Fact_BillingInvoice[ID_Customer] ),
Fact_BillingInvoice[InvoiceDate] >= one_year_back,
Fact_BillingInvoice[InvoiceDate] <= TODAY ()
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
You can try the following dax measure
Active Customers =
VAR OneYearBack = DATEADD(Dim_Date[Date], -1, YEAR)
RETURN
CALCULATE( DISTINCTCOUNT(Fact_BillingInvoice[ID_Customer]),
FILTER( Fact_BillingInvoice,
Fact_BillingInvoice[InvoiceDate] >= OneYearBack &&
Fact_BillingInvoice[InvoiceDate] <= TODAY()
)
)
Hi, Thanks for your help but this does not seem to work. Error: a table of multiple values was supplied where a single value was expected
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
75 | |
54 | |
38 | |
31 |
User | Count |
---|---|
99 | |
56 | |
50 | |
42 | |
40 |