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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculate sell with DAX

Hi Team,

Hi,

 

I have some problem with the data setting.

I have two excel files, one is inventory report downloaded from System A, which only updates the last day of each month.

Another is purchase data downloaded from System B which updates by weekly.

 

I need to use the inventory and the purchase data to calculate the sales for all customers (using the end-of-month inventory as the starting point, initial inventory + purchases - ending inventory = sales).

 

The customers and product categories in Systems A and B are not completely the same, but my sales need to cover all customers and products from both systems.  

 

* the data links as below

https://1drv.ms/f/c/8122f38c2b712de8/EmG3_hi5YQlFsfOPiBNmzO4BX5FtTAviFeLh-BgH_nFD8g?e=BHWW07

 

*How can I caculate every customers every SKU sales by month

*How can I caculate every customers every SKU sales by MOM & P3M

 

thanks in advance!!

1 ACCEPTED SOLUTION

Hi @Anonymous 

I have attached the PBIX.

I made some adaptions by creating dimension tables. Some of the calculated columns and Dimension tables I would have created in Power Query.

 

Joe

 

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


View solution in original post

3 REPLIES 3
Joe_Barry
Super User
Super User

Hi @Anonymous 

 

Access denied on the data

Before you can calculate you will need to clean the customer and product categories in Systems A & B, so that they match on both tables.

 

The next step would be to build you data model in a Star Schema (Link in my Bio) This means creating a table with just Customer Names and IDs and a table with Just Product names and ID. You will also need a Date Table (Link in my Bio)

 

Follw the Star Schema instructions, then you can start on your measures

 

To create a Sales measure

 

 

Total Sales = SUM('TableB'[Amount])

 

 

To get MoM you can use one measure, but for clarity, let's break it down.

 

 

Sales MTD = TOTALMTD({Total Sales], 'Calendar'[Date]) ///use the previous measure Total Sales

 

 

ou will need the previous month's value to calculate MoM

 

Sales PM = 
CALCULATE(
   [Sales MTD],
     DATEADD('Calendar'[Date], -1, MONTH)
)

 

 

MoM %

 

MoM % = 
VAR _Diff = [Sales MTD] - [Sales PM]
RETURN
DIVIDE( _Diff, [Sales PM],0)

 

 convert then to %

 

Last 3 Months

 

 

Sales L3M =
CALCULATE (
    [Total Sales],
    DATESINPERIOD ( 'DIM Date'[Date], 
    MAX ( 'Calendar'[Date] ), -3, MONTH )
)

 

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Anonymous
Not applicable

Hi @Anonymous 

I have attached the PBIX.

I made some adaptions by creating dimension tables. Some of the calculated columns and Dimension tables I would have created in Power Query.

 

Joe

 

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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