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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

sum of amount corresponding to date range

Hi All,

Below is my sample data,

RohiniP-26_0-1610220274228.png

Expected output: ( date filter 01-02-2020 to 31-03-2020)

RohiniP-26_2-1610221258096.png

Assume that, I have data upto 30-04-2020.

I need to calculate the last 3 columns (as measures) and want to show the sum of sales amount where 'End total'=1.

Problem is that, I don't have date value, where 'End total'=1. This row is just to show the sum.

1) sum amount (selected range) - sum of sales amount between selected date range in the date filter.

2) sum amount (before selected range) - sum of sales amount, date ranges from begining (in this ex 01-01-2020) to the max selected date (To date in date filter).

3) sum amount (upto last date) - sum of sales amount which is not affected by date filter, that includes all date (ie from begining to ending of data).

 

Thanks in advance.......

1 ACCEPTED SOLUTION
littlemojopuppy
Community Champion
Community Champion

Hi @Anonymous 

 

Try these measures

Total Sales = SUM(Sales[Sales Amount])

Sales in Date Range = 
    IF(
        ISFILTERED(Sales[Date]),
        BLANK(),
        CALCULATE(
            [Total Sales],
            VALUES('Calendar'[Date])
        )
    )

Sales Before Date Range = 
    VAR MaximumDate =
        MAXX(
            VALUES('Calendar'[Date]),
            'Calendar'[Date]
        )
    RETURN

    IF(
        ISFILTERED(Sales[Date]),
        BLANK(),
        CALCULATE(
            [Total Sales],
            'Calendar'[Date] <= MaximumDate
        )
    )

All Sales = 
    IF(
        ISFILTERED(Sales[Date]),
        BLANK(),
        CALCULATE(
            [Total Sales],
            ALL('Calendar'[Date])
        )
    )

 

Here's the results

littlemojopuppy_0-1610302304464.png

 

Hope this helps!  🙂

View solution in original post

2 REPLIES 2
littlemojopuppy
Community Champion
Community Champion

Hi @Anonymous 

 

Try these measures

Total Sales = SUM(Sales[Sales Amount])

Sales in Date Range = 
    IF(
        ISFILTERED(Sales[Date]),
        BLANK(),
        CALCULATE(
            [Total Sales],
            VALUES('Calendar'[Date])
        )
    )

Sales Before Date Range = 
    VAR MaximumDate =
        MAXX(
            VALUES('Calendar'[Date]),
            'Calendar'[Date]
        )
    RETURN

    IF(
        ISFILTERED(Sales[Date]),
        BLANK(),
        CALCULATE(
            [Total Sales],
            'Calendar'[Date] <= MaximumDate
        )
    )

All Sales = 
    IF(
        ISFILTERED(Sales[Date]),
        BLANK(),
        CALCULATE(
            [Total Sales],
            ALL('Calendar'[Date])
        )
    )

 

Here's the results

littlemojopuppy_0-1610302304464.png

 

Hope this helps!  🙂

My solution assumes you have a date table and it is marked accordingly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.