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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
dwhittaker1
Helper I
Helper I

calculate gross sales before certain date

I would like to create a measure that calculates the total Gross sales for each customer where identity = Sales Table  and invoice date is before 1/1/2024.

 

Based on the table below the desired result would be  Customer  A has 3,000 in Gross Sales

 

 

Segment   Site Name   Customer                   Identity   Gross Sales      InvoiceDate   
lightNYASales Table10001/1/2020
lightNCASales Table10001/1/2024
lightNCASales Table2001/1/2023
plasticNCASales Table3002/1/2024
plasticNCASales Table50012/1/2023
paperNCASales Table100011/1/2022
paperNCASales Table20004/1/2024
coalALASales Table10011/1/2022
coalALASales Table1006/1/2024
coalALASales Table2005/1/2023
coalALABudget Table1006/1/2024
coalALABudget Table2005/1/2023
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@dwhittaker1 

Give this a try.

 

Pre 2024 gross sales =
CALCULATE (
    SUM ( YourTable[Gross Sales] ),
    YourTable[Identity] = "Sales Table",
    YourTable[InvoiceDate] < DATE ( 2024, 1, 1 )
)

jdbuchanan71_0-1719850976009.png

 

 

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

@dwhittaker1 

Give this a try.

 

Pre 2024 gross sales =
CALCULATE (
    SUM ( YourTable[Gross Sales] ),
    YourTable[Identity] = "Sales Table",
    YourTable[InvoiceDate] < DATE ( 2024, 1, 1 )
)

jdbuchanan71_0-1719850976009.png

 

 

@jdbuchanan71 thank you, this works perfectly. I have a page level slicer that slices on the year 2024. Can you help me edit your measure so that it is not impacted by this page level slicer?

Yep, we can force it to ignore anything outside the measure like this.

Pre 2024 gross sales =
CALCULATE (
    SUM ( YourTable[Gross Sales] ),
    REMOVEFILTERS ( YourTable ),
    YourTable[Identity] = "Sales Table",
    YourTable[InvoiceDate] < DATE ( 2024, 1, 1 )
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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