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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Kayslam
Frequent Visitor

How to match customer IDs between months and return a decrease or increase in sales

I will really appreciate help with this.

 

I have 12 months of data. I have columns containing unique customer IDs, location and and sale units. I want to compare the change in units by mactching the customer IDs from month to month. 

 

(1) I'm particularly looking at the "decrease in units for existing customers", and the "increase in units for existing customers and new customers"

(2) And return a distinct location count for the two scenarios above.

 

In short:

 

1. How many sale units have been added from the previous month (additions could come from new and existing customers)?

2. How many location by distinct count did the additions come from?

3.What was the decrease in sale units from the previous month by existing customer ID ? 

(A decrease could happen by loosing a customer entirely or just lost of partial sale)

4. How many locations by distinct count did the decrease come from?

 

Table Columns:

Date         Customer ID       Revenue       Units        Location

 

Expected Results:

Table columns (Units)

Month(YY-MM)      Beginning Units    Units Added      Units lost      Net Units     Ending Units

 

Table Columns (Locations)

Month(YY-MM)      Beginning Locations    Locations Added      Locations lost      Net Location      Ending Locations

 

 

 

I was able to get the units and locations added but it didn't work for the units and locations lost on the other way round.

CALCULATE([VARIANCE],FILTER(SUMMARIZE('Sales','Sales'[customer_id]),[VARIANCE] > 0))
 
CALCULATE(COUNTROWS(SUMMARIZE('Sales','Sales'[customer_id])),FILTER(SUMMARIZE('Slaes','Sales'[customer_id]),'Sales'[VARIANCE] > 0))
 
CALCULATE([UNITS SUM], DATESMTD('Date'[Date]))
 
CALCULATE([UNITS SUM], DATESMTD(DATEADD('Date Table'[Date],-1,MONTH)))

 

 

 

 

 

 

 

 

 

 

2 REPLIES 2
v-binbinyu-msft
Community Support
Community Support

Hi @Kayslam ,

In order to better understand your demands and give the right solution, could you please provide some more specific information? such as your desensitized example data and a screenshot of your desired results?

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_ Binbin Yu

Thanks @v-binbinyu-msft  I have modified my post. I hope this helps. I'm happy to clarify as needed. Thanks again for your help.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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