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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Find clients who haven't ordered since

Hi,

 

I'm trying to find the number of customers who ordered "SAMEPERIODLASTYEAR" but not this year.

Here's my formula:

 

 

 

Non reco = 
VAR CurrentFY = CALCULATE(
    SUM(Overview[Net Invoice Sales])
)
VAR YAG = CALCULATE(
    SUM(Overview[Net Invoice Sales]);
    SAMEPERIODLASTYEAR('Date'[Date])
)
RETURN
CALCULATE(
    --YAG-CurrentFY
    DISTINCTCOUNT(Overview[Customer]);
    FILTER(Overview;YAG>0);
    FILTER(Overview;CurrentFY=0);
)

 

All I get is an empty column.

For info, when I simply try to do "YAG-CurrentFY", i do get a figure, proving if need be that I should get customers who didnt order this year.

 

For better understanding, my 'Overview' table is a big table (~6M rows) with a detail of all units ordered by customers with the corresponding order date. My 'Date' table is a... date table, and declared as such through PowerBI.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @amitchandak ,

 

Thanks a lot for your quick reply.

I tried your technique, but it didnt work.

 

I have however found the solution, as my own summarize for previous year was incorrectly created due to a pre-existing slicer.

To ignore said slicer, I used this formula:

 

Non reco = 
VAR YAG = SUMMARIZE(
    CALCULATETABLE(
        Overview,
        ALL('Date'[Date]),
        SAMEPERIODLASTYEAR('Date'[Date])
    ),
    Overview[Customer]
)
VAR CurrentFiscal = SUMMARIZE(
    Overview,
    Overview[Customer]
)
RETURN
COUNTROWS(EXCEPT(YAG,CurrentFiscal))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try to change return as

CALCULATE(
DISTINCTCOUNT(Overview[Customer]);
FILTER(all(Overview);YAG>0 && coalesce(CurrentFY,0)= 0)
)

 

As the date range will apply to the return statement, those who did not have sales year will not come. So need to use all

 

Anonymous
Not applicable

Hi @amitchandak ,

 

Thanks a lot for your quick reply.

I tried your technique, but it didnt work.

 

I have however found the solution, as my own summarize for previous year was incorrectly created due to a pre-existing slicer.

To ignore said slicer, I used this formula:

 

Non reco = 
VAR YAG = SUMMARIZE(
    CALCULATETABLE(
        Overview,
        ALL('Date'[Date]),
        SAMEPERIODLASTYEAR('Date'[Date])
    ),
    Overview[Customer]
)
VAR CurrentFiscal = SUMMARIZE(
    Overview,
    Overview[Customer]
)
RETURN
COUNTROWS(EXCEPT(YAG,CurrentFiscal))

Hi @Anonymous ,

 

I'm glad you solved your problem and shared the solution. Please consider Accept it as the solution to help the other members find it more quickly.

 

Thanks for your understanding and support.

 

Best Regards,

Dedmon Dai

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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