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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dhodgson
Frequent Visitor

Sales Figure between two date columns and two sales columns

Hi 

 

I need to calculate the total sales between two dates and this comes from 2x revenue columns & 2 different date columns, example below.

 

What formula can I use to have the SCDATE & INVDATE search between 01/07/2023 – 30/06/2024 and then sum SCTOTAL & INVVAL to find the final value.

 

SERVCARDIDSCTOTALSCDATEINVVALUEINVDATE
123546  30.5626/05/2024
789456115.301/03/2024  
94770720.828/06/2024  

 

Thanks, 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dhodgson ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1719899335450.png

vtianyichmsft_1-1719899347984.png

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @dhodgson ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1719899335450.png

vtianyichmsft_1-1719899347984.png

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Joe_Barry
Super User
Super User

Hi @dhodgson 

 

Should the time frame be dynamic?  If you have a date table in your data model, this solution is dynamic.

 

  • Create a one to many relationship from the Date table date column to the SCDATE column in your table, this should be an active relationship
  • Repeat the same but this time to the INVDATE column, this relationship will be automatically be in active, leave it rthis way as it's expected behaviour
  • You van combine these into one measure, but as good practice, I will like to separate my measure out

 

SC Sales = SUM(Table1[SCTotal])​
Invoice Sales =
CALCULATE(
   SUM(Table1[INVVALUE]), 
   USERELATIONSHIP(Date[Date], Table1[INVDATE])​
Total Sales =
[SC Sales] + [Invoice Sales]

 

  • Create a Date slice, using the date column from the Date table. Then add your measure to any visual. If you are looking at visuals over time, use the date related context from the Date table.

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


aduguid
Super User
Super User

Measure for SCTOTAL filtered by SCDATE

Total_SCTOTAL = 
CALCULATE(
    SUM('YourTable'[SCTOTAL]),
    FILTER(
        'YourTable',
        'YourTable'[SCDATE] >= DATE(2023, 7, 1) &&
        'YourTable'[SCDATE] <= DATE(2024, 6, 30)
    )
)

Measure for INVVALUE filtered by INVDATE

Total_INVVALUE = 
CALCULATE(
    SUM('YourTable'[INVVALUE]),
    FILTER(
        'YourTable',
        'YourTable'[INVDATE] >= DATE(2023, 7, 1) &&
        'YourTable'[INVDATE] <= DATE(2024, 6, 30)
    )
)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.