Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
willpioli
Frequent Visitor

Customers who is not buying

Im actually trying to build a report that shows all custmers that are on the list but doest have a register in the last xx months.

 

My main table contais the DATE of pursharse, customer name, product name, value.

 

So, what i want is to create a list of customers who had brought in the las 12 months and didnt brough on the last 3 months for example, and i want to make it works with some filters where i can select the period the customers brought and the period whitch they are not buying.

 

I tryed some formulas like:

 

Faturamento No periodo em que comprou = 
IF (
    MIN ( 'Date'[Date] )
        <= CALCULATE ( MAX ( BaseFat2[DataFat] ); ALL ( BaseFat2 ) );
    CALCULATE (
        SUM ( BaseFat2[Valor Liquido Gerencial] );
        FILTER (
            ALL ( 'BaseFat2'[DataFat]);
            BaseFat2[DataFat] <= MAX ( BaseFat2[DataFat] )
        )
    )

 and this

 

Faturmento no Periodo em que não comprou = 
CALCULATE (
    SUM ( BaseFat2[Valor Liquido Gerencial] );
    FILTER (
        ALL ( BaseFat2[DataFat] );
       -- DATEADD(BaseFat2[DataFat];-12;MONTH)
		 'BaseFat2'[DataFat] <= MAX (BaseFat2[DataFat])
    )
)

 

image.png

 

 

ty!!

 

1 ACCEPTED SOLUTION

@willpioli

 

Hi,

 

You can try this formula as a measure.

Check =
VAR TwoYears =
    CALCULATE (
        COUNTA ( 'Table1'[Invoice] );
        DATESINPERIOD ( 'Date'[Date]; TODAY (); -2; YEAR )
    )
VAR ThreeMonth =
    CALCULATE (
        COUNTA ( 'Table1'[Invoice] );
        DATESINPERIOD ( 'Date'[Date]; TODAY (); -3; MONTH )
    )
RETURN
    IF ( ISBLANK ( TwoYears ) = FALSE () && ISBLANK ( ThreeMonth ) = TRUE (); 1; 0 )

The reason of using "Counta" is to avoid the invoice with 0 value. You can use Sum(value) or other functions.Customers who is not buying .jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-jiascu-msft
Employee
Employee

@willpioli

 

Hi,

 

Maybe you can check these thing below. What’s the problem exactly? Could you please post a sample with the relationship here?

  1. These tables should have proper relationships.
  2. The columns of the filters should come from proper table.

  

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I just have a full table with all my data:

 

order date,

invoice n,

product,

customer,

value

 

and another calendar table:

 

Date = 
ADDCOLUMNS (
CALENDAR (DATE(2009;1;1); DATE(2017;12;31));
"DateAsInteger"; FORMAT ( [Date]; "YYYYMM" );
"Year"; YEAR ( [Date] );
"Monthnumber"; FORMAT ( [Date]; "MM" );
"YearMonthnumber"; FORMAT ( [Date]; "MM/YYYY" );
"YearMonthShort"; FORMAT ( [Date]; "MMM/YYYY" );
"MonthNameShort"; FORMAT ( [Date]; "MMM" );
"MonthNameLong"; FORMAT ( [Date]; "MMMM" );
--"DayOfWeekNumber"; WEEKDAY ( [Date] );
--"DayOfWeek"; FORMAT ( [Date]; "dddd" );
--"DayOfWeekShort"; FORMAT ( [Date]; "ddd" );
"Quarter"; "Q" & FORMAT ( [Date]; "Q" );
"YearQuarter"; FORMAT ( [Date]; "YYYY" ) & "/Q" & FORMAT ( [Date]; "Q" )
)

 

 

I dont need to know the new custumers, just who bought in a certain period (has any register with orderdate in the period selected) and is had not bought in any other certain period.

 

Ex.:

Customers who bought in the last 2 years (has a invoice in the last 2 years) but didnt bought in the last 3 months (dont have any invoice in the period)

 

I´ve tryed the formulas i posted on the first msg, and tryed to use the formulas on the http://www.daxpatterns.com/new-and-returning-customers/ but no sucess....

 

 

@willpioli

 

Hi,

 

You can try this formula as a measure.

Check =
VAR TwoYears =
    CALCULATE (
        COUNTA ( 'Table1'[Invoice] );
        DATESINPERIOD ( 'Date'[Date]; TODAY (); -2; YEAR )
    )
VAR ThreeMonth =
    CALCULATE (
        COUNTA ( 'Table1'[Invoice] );
        DATESINPERIOD ( 'Date'[Date]; TODAY (); -3; MONTH )
    )
RETURN
    IF ( ISBLANK ( TwoYears ) = FALSE () && ISBLANK ( ThreeMonth ) = TRUE (); 1; 0 )

The reason of using "Counta" is to avoid the invoice with 0 value. You can use Sum(value) or other functions.Customers who is not buying .jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lalthan
Resolver II
Resolver II

Check this page (Link below)

 

New and Returning Customers

this formulas are not working on power bi

That's too vague, what is not working?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.