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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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