cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Need help understanding Dax (Lost Customers)

Hi,  

 

I need a calculation that works out which customers have not spent with us this year.

 

I have tried to copy some code from the internet (Dangerous) but it does not work

 

Lost Customers = IF(
HASONEVALUE( insertBK[dateins] ) ,
COUNTROWS ( FILTER ( CALCULATETABLE ( VALUES( adDetails[TrueCompany]),
FILTER( ALL(insertBK[dateins]), insertBK[dateins] =
DATEADD( VALUES( insertBK[dateins] ), -1, MONTH )
), ALL(insertBK[dateins])
) ,
adDetails[TrueCompany]<>
CALCULATETABLE( VALUES ( adDetails[TrueCompany] ) )
)
))

To be honest I am njot sure what it is returning.  I have changed the tables in the code to where I think it should be pointing.

 

I am trying to understand what is going on and why it is not working, would someone be able to explain to me.

 

Thanks

 

Chris

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Need help understanding Dax

Hi @Anonymous,

 

If your sales table only contain the consumption records, you can filter the records by date(for example 2015) then get the customer column from the filtered table and use EXCEPT Function to filter data with customer table.

 

If above is not help, can you share some sample data?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

Super User I
Super User I

Re: Need help understanding Dax (Lost Customers)

Hi @Anonymous

 

Follow the link

 

New and Returning Customers

Repeat Customers in DAX: Three Flavors

 

They are excellent postings on this topic which clearly explain the logic behind doing the calculations.

 

If this helps please give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Re: Need help understanding Dax

Or something like

 

Lost Customers = CALCULATE(sum(insertBK[InsertNetCost]),'Calendar$'[Year]=2015,var x = CALCULATE(sum(insertBK[InsertNetCost]),'Calendar$'[Year]=2015) = null)

 

which doesnt work

Community Support Team
Community Support Team

Re: Need help understanding Dax

Hi @Anonymous,

 

If your sales table only contain the consumption records, you can filter the records by date(for example 2015) then get the customer column from the filtered table and use EXCEPT Function to filter data with customer table.

 

If above is not help, can you share some sample data?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

Super User I
Super User I

Re: Need help understanding Dax (Lost Customers)

Hi @Anonymous

 

Follow the link

 

New and Returning Customers

Repeat Customers in DAX: Three Flavors

 

They are excellent postings on this topic which clearly explain the logic behind doing the calculations.

 

If this helps please give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

Anonymous
Not applicable

Re: Need help understanding Dax (Lost Customers)

Thanks guys, will lookk into that see how I get on.

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors